Skip to content

Commit 2299949

Browse files
authored
Merge pull request #264 from maxmind/greg/eng-2546
Add support for freethreading in extension
2 parents 2edb084 + f833c8f commit 2299949

File tree

12 files changed

+628
-51
lines changed

12 files changed

+628
-51
lines changed

.github/workflows/test-libmaxminddb.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
env: [3.9, "3.10", 3.11, 3.12, 3.13, 3.14]
16+
env: ["3.10", 3.11, 3.12, 3.13, 3.14]
1717
# We don't test on Windows currently due to issues
1818
# build libmaxminddb there.
1919
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
@@ -56,7 +56,7 @@ jobs:
5656
echo "LDFLAGS=-L/opt/homebrew/lib" >> "$GITHUB_ENV"
5757
5858
- name: Build with Werror and Wall
59-
run: uv build
59+
run: uv build --python ${{ matrix.env }}
6060
env:
6161
CFLAGS: "${{ env.CFLAGS }} -Werror -Wall -Wextra"
6262

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
env: [3.9, "3.10", 3.11, 3.12, 3.13, 3.14]
18+
env: ["3.10", 3.11, 3.12, 3.13, 3.14]
1919
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
2020
steps:
2121
- uses: actions/checkout@v5
@@ -32,6 +32,7 @@ jobs:
3232
- name: Setup test suite
3333
run: tox run -vv --notest --skip-missing-interpreters false
3434
env:
35+
MAXMINDDB_REQUIRE_EXTENSION: 1
3536
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
3637
- name: Run test suite
3738
run: tox run --skip-pkg-install

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ History
66
2.9.0
77
++++++++++++++++++
88

9+
* IMPORTANT: Python 3.10 or greater is required. If you are using an older
10+
version, please use an earlier release.
911
* Databases can now be loaded from buffers. This can be done by passing in a
1012
buffer as the database and using mode ``MODE_FD``. Pull request by Emanuel
1113
Seemann. GitHub #234.
14+
* The C extension now supports Python 3.13+ free-threading mode and is
15+
thread-safe for concurrent reads on platforms with pthread support (such as
16+
Linux and macOS) and Windows. On other platforms, the extension will use
17+
GIL-based protection.
1218

1319
2.8.2 (2025-07-25)
1420
++++++++++++++++++

README.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,20 @@ The module will return an ``InvalidDatabaseError`` if the database is corrupt
9494
or otherwise invalid. A ``ValueError`` will be thrown if you look up an
9595
invalid IP address or an IPv6 address in an IPv4 database.
9696

97+
Thread Safety
98+
-------------
99+
100+
Both the C extension and pure Python implementations are safe for concurrent
101+
reads and support Python 3.13+ free-threading. The C extension provides
102+
free-threading support on platforms with pthread support (such as Linux and
103+
macOS) and Windows. On other platforms, the extension will use GIL-based
104+
protection. Calling ``close()`` while reads are in progress may cause
105+
exceptions in those threads.
106+
97107
Requirements
98108
------------
99109

100-
This code requires Python 3.9+. Older versions are not supported. The C
110+
This code requires Python 3.10+. Older versions are not supported. The C
101111
extension requires CPython.
102112

103113
Versioning

0 commit comments

Comments
 (0)