Skip to content

PdfParser: Don't use list as def in read_prev_trailer#9629

Open
danigm wants to merge 2 commits into
python-pillow:mainfrom
danigm:dont-use-list-as-default-arg
Open

PdfParser: Don't use list as def in read_prev_trailer#9629
danigm wants to merge 2 commits into
python-pillow:mainfrom
danigm:dont-use-list-as-default-arg

Conversation

@danigm
Copy link
Copy Markdown

@danigm danigm commented May 13, 2026

Backporting this patch into some openSUSE distro I've detected that it adds an empty list as a default value in a method.

It's not recommended to use the empty list as default value in functions or methods because Python interpreter evaluates during parsing, so it will be the same list for different calls.

https://pylint.pycqa.org/en/latest/user_guide/messages/warning/dangerous-default-value.html

It's not recommended to use the empty list as default value in functions
or methods because Python interpreter evaluates during parsing, so it
will be the same list for different calls.

https://pylint.pycqa.org/en/latest/user_guide/messages/warning/dangerous-default-value.html
Comment thread src/PIL/PdfParser.py Outdated
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants