TabbycatDebate / tabbycat

Debating tournament tabulation software for British Parliamentary and a variety of two-team parliamentary formats
https://tabbycat.readthedocs.io/
GNU Affero General Public License v3.0
242 stars 806 forks source link

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

Open elayeek opened 1 month ago

elayeek commented 1 month ago

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 commented 1 month ago

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

https://github.com/TabbycatDebate/tabbycat/pull/2482