Skip to content

Fix mutable default arguments#385

Merged
tonylampada merged 1 commit intomainfrom
codex/fix-mutable-default-argument-issue
Jun 3, 2025
Merged

Fix mutable default arguments#385
tonylampada merged 1 commit intomainfrom
codex/fix-mutable-default-argument-issue

Conversation

@tonylampada
Copy link
Copy Markdown
Collaborator

@tonylampada tonylampada commented Jun 3, 2025

Description

Fixes Python's common pitfall of using mutable objects (lists and dictionaries) as default function arguments. Mutable defaults are shared across function calls, which can lead to unexpected behavior when the default value is modified.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

  • Ran make style successfully
  • Attempted make check_code_quality (blocked by missing stub packages)
  • Attempted python -m unittest (blocked by missing dependencies)

Will the change affect Universe? If so was this change tested in universe?

No

Any specific deployment considerations

None - this is a backward-compatible fix that prevents potential bugs without changing API behavior.

@tonylampada tonylampada marked this pull request as ready for review June 3, 2025 17:19
@tonylampada tonylampada requested a review from iurisilvio June 3, 2025 17:19
@tonylampada tonylampada self-assigned this Jun 3, 2025
@tonylampada tonylampada merged commit c570d22 into main Jun 3, 2025
16 checks passed
@iurisilvio iurisilvio deleted the codex/fix-mutable-default-argument-issue branch August 27, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants