Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Bug: Use of mutable default arguments in python #2483

Open
elayeek opened this issue Aug 13, 2024 · 1 comment · May be fixed by #2482
Open

Potential Bug: Use of mutable default arguments in python #2483

elayeek opened this issue Aug 13, 2024 · 1 comment · May be fixed by #2482

Comments

@elayeek
Copy link

elayeek commented Aug 13, 2024

This is a niche issue but this is a common pitfall in Python that causes unexpected behavior.

Python evaluates functions on module load and generates mutable default argument objects once, then persist them whenever the function is called.

https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments

@elayeek
Copy link
Author

elayeek commented Aug 13, 2024

Minor PR to fix it (I need to run tests and linter again)

#2482

@tienne-B tienne-B linked a pull request Aug 14, 2024 that will close this issue
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 a pull request may close this issue.

1 participant