Pull request overview
Fixes an issue where replacing callback_data in InlineKeyboardButtons (when arbitrary_callback_data is enabled) drops other button attributes by cloning the original button before mutation.
Changes:
- Update
CallbackDataCache.process_keyboardtodeepcopybuttons before updatingcallback_data. - Extend the callback data cache test to assert preservation of non-
callback_dataattributes. - Add an unreleased changelog entry for the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/ext/test_callbackdatacache.py | Adds assertions to verify additional InlineKeyboardButton attributes are preserved after callback_data replacement. |
| src/telegram/ext/_callbackdatacache.py | Clones buttons before modifying callback_data to preserve all original button attributes. |
| changes/unreleased/5159.oRWyrKjKtGSS28NxvnJnCy.toml | Adds an unreleased note describing the behavior change/fix. |