Skip to content

Deduplicate module initialization#64

Merged
peytondmurray merged 11 commits intoQuansight:mainfrom
peytondmurray:63-deduplicate-module-initialization
Jan 28, 2026
Merged

Deduplicate module initialization#64
peytondmurray merged 11 commits intoQuansight:mainfrom
peytondmurray:63-deduplicate-module-initialization

Conversation

@peytondmurray
Copy link
Collaborator

@peytondmurray peytondmurray commented Jan 27, 2026

This PR patches the pyodbc module initialization, making npyodbcmodule.cpp the only place where PyInit_<module_name> is called.

Other changes

  • As an additional step towards Code documentation #11, we also move the compiled extension into a submodule, at npyodbc._npyodbc. As a result of this choice, we now also run the CI tests from inside tests/ directly; otherwise pytest will add the root of the repo to sys.path (yes, even without a tests/__init__.py and with --import-mode=importlib) and thus inadvertently try to import the local npyodbc rather than the one installed at site-packages, causing it to fail to find the compiled extension.
  • Old tests were removed; they can't be run anyway due to some missing modules.
  • Add missing -Wno-write-strings cflag for Unix builds to suppress compiler warnings

Closes #63.

@peytondmurray
Copy link
Collaborator Author

peytondmurray commented Jan 28, 2026

See mkleehammer/pyodbc#1450 for upstream segfault discussion.

A null-commit applied to pyodbc==5.3.0 generates the same segfault: peytondmurray/pyodbc#1, so I don't consider these test failures as blocking.

@peytondmurray peytondmurray force-pushed the 63-deduplicate-module-initialization branch from ff33205 to cfcb6e2 Compare January 28, 2026 00:26
@peytondmurray peytondmurray merged commit c3a63f1 into Quansight:main Jan 28, 2026
19 of 25 checks passed
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.

Module initialization is duplicated

1 participant