Skip to content

[BUG] (Ext)Bot._insert_defaults edits objects in-place #3305

@Bibo-Joshi

Description

@Bibo-Joshi

Steps to Reproduce

  1. create an InputMediaPhoto with a HTML-Caption
  2. use it in a send_media_group call of a bot without Defaults
  3. use it in a send_media_group call of a bot with Defaults.parse_mode

Expected behaviour

in step 3., the html markup is parsed by TG

Actual behaviour

it's not.

Operating System

Any

Version of Python, python-telegram-bot & dependencies

PTB v20

Relevant log output

No response

Additional Context

This is due to _insert_defaults doing something like media.parse_mode = None. Instead it should create a copy of media and set the parse mode on the copy.

This issue surfaced in #3295 (#3295 (comment)) and was also teased in #3249.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions