Skip to content

fix: prevent shared state bugs from mutable default arguments - #175

Merged
jpvanhal merged 1 commit into
masterfrom
fix-mutable-default-arguments
Feb 15, 2026
Merged

jpvanhal merged 1 commit into
masterfrom
fix-mutable-default-arguments

Conversation

@jpvanhal

Copy link
Copy Markdown
Member

Change SearchManager.__init__() and make_searchable() to use options=None instead of options={} to prevent shared mutable state across function calls.

  • SearchManager.__init__() now creates a copy of default_options to prevent mutating the class-level dictionary
  • Update SQLConstruct.init_options() to properly handle option priority (column-specific > passed > defaults)
  • SearchManager.attach_ddl_listeners() now passes options to SQL construct instances to ensure runtime-modified options are respected

This eliminates bugs where modifying options in one call could affect subsequent calls due to shared dictionary references.

Change `SearchManager.__init__()` and `make_searchable()` to use
`options=None` instead of `options={}` to prevent shared mutable state
across function calls.

- `SearchManager.__init__()` now creates a copy of `default_options` to
  prevent mutating the class-level dictionary
- Update `SQLConstruct.init_options()` to properly handle option
  priority (column-specific > passed > defaults)
- `SearchManager.attach_ddl_listeners()` now passes options to SQL
  construct instances to ensure runtime-modified options are respected

This eliminates bugs where modifying options in one call could affect
subsequent calls due to shared dictionary references.
@jpvanhal
jpvanhal merged commit 63bbb3d into master Feb 15, 2026
21 checks passed
@jpvanhal
jpvanhal deleted the fix-mutable-default-arguments branch February 15, 2026 09:56
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.

1 participant