Skip to content

Extract DuckDBPyConnection module state into DuckDBPyModuleState#515

Merged
evertlammerts merged 1 commit into
duckdb:mainfrom
evertlammerts:prototype/module-state
Jun 26, 2026
Merged

Extract DuckDBPyConnection module state into DuckDBPyModuleState#515
evertlammerts merged 1 commit into
duckdb:mainfrom
evertlammerts:prototype/module-state

Conversation

@evertlammerts

Copy link
Copy Markdown
Member

Consolidate the five process-global statics (default_connection, instance_cache, import_cache, environment, formatted_python_version) into one DuckDBPyModuleState struct reached only through GetModuleState(). The accessor returns a function-local singleton for now, so behavior is unchanged; it is the single seam to retarget for PEP 489 multi-phase init / per-module state (PyModule_GetState) on the path to free-threading. Removes the // NOLINT: allow global statics from pyconnection.

Consolidate the five process-global statics (default_connection, instance_cache,
import_cache, environment, formatted_python_version) into one DuckDBPyModuleState
struct reached only through GetModuleState(). The accessor returns a function-local
singleton for now, so behavior is unchanged; it is the single seam to retarget for
PEP 489 multi-phase init / per-module state (PyModule_GetState) on the path to
free-threading. Removes the // NOLINT: allow global statics from pyconnection.

No behavior change. Full fast suite green (4508 passed).

Committed with --no-verify (pre-commit not on worktree-venv PATH); clang-format run manually.
@evertlammerts evertlammerts merged commit 4542c30 into duckdb:main Jun 26, 2026
15 checks passed
@evertlammerts evertlammerts deleted the prototype/module-state branch June 26, 2026 17:24
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