-
Notifications
You must be signed in to change notification settings - Fork 39
Add support for freethreading in extension #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
527162b
to
6da0cf6
Compare
Implements thread-safe concurrent database operations for Python's free-threading mode using native locks where available. - Uses native RW locks (pthread_rwlock_t on POSIX, SRWLOCK on Windows) to allow multiple concurrent readers - Uses GIL on platforms that don't support these native locks - Zero overhead when GIL is enabled (macros compile to no-ops)
We already have some threading coverage in the general reader tests, but this provides more detailed implementation tests for the extension.
To ensure we are forcing correct checks in CI
The C extension was being built but not imported during tests due to Python's sys.path ordering. The project root directory was appearing first in sys.path, causing Python to import from the source directory (which doesn't have the compiled .so file) instead of the installed package in site-packages. Changes: - Add pytest --import-mode=importlib to prevent pytest from adding the project root to sys.path, ensuring tests import from the installed package in the tox virtualenv - Add MAXMINDDB_REQUIRE_EXTENSION=1 to the "Setup test suite" step to ensure the extension is built during CI setup
6da0cf6
to
2f45722
Compare
horgh
requested changes
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
b18aa4f
to
e790028
Compare
This prevents a race in ReaderIter_next and protects against writes that are not atomic for the others.
e790028
to
f833c8f
Compare
horgh
approved these changes
Oct 14, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #249.