harshil21 · GitHub

@harshil21

@harshil21

@harshil21

@harshil21 @github-actions

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_keyboard to deepcopy buttons before updating callback_data.
  • Extend the callback data cache test to assert preservation of non-callback_data attributes.
  • 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.

@harshil21

aelkheir

@harshil21

@harshil21

Poolitzer

@harshil21

@harshil21

Read the original on github.com ↗