Skip to content

Fix potential default mutable issue introduced in #2274#2442

Merged
Avasam merged 1 commit intomhammond:mainfrom
Avasam:fix-potential-default-mutable-issue
Mar 4, 2025
Merged

Fix potential default mutable issue introduced in #2274#2442
Avasam merged 1 commit intomhammond:mainfrom
Avasam:fix-potential-default-mutable-issue

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Dec 31, 2024

Introduced in #2274, was missed in the original review. I manually re-reviewed and didn't find any other similar regression.

Simplified demonstration of the issue:

>>> def RegisterServer(catids=[]):
...     catids.append("hi")
...     return catids
...
>>> RegisterServer()
['hi']
>>> RegisterServer()
['hi', 'hi']
>>> RegisterServer()
['hi', 'hi', 'hi']

There are linting rules to avoid using mutable defaults for such reasons. But we don't use them yet.

I'm just reverting this one line as an easy fix

@Avasam Avasam requested a review from mhammond December 31, 2024 02:42
@Avasam
Copy link
Copy Markdown
Collaborator Author

Avasam commented Mar 4, 2025

@mhammond This fixes a potential regression in 307

@Avasam Avasam merged commit a7f286e into mhammond:main Mar 4, 2025
@Avasam Avasam deleted the fix-potential-default-mutable-issue branch March 4, 2025 16:17
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