- Notifications
You must be signed in to change notification settings - Fork 435
Add Python 3.14 support, experimental subinterpreter/freethreading support#1279
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
elprans commented Oct 13, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
ddanier commented Oct 14, 2025
As of no pre-built package being available for What I want to say: I really would like this to get finished and merged soon. Thanks for all the effort! ;-) |
e742ff7 to 7037527CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
483125b to fd6d675CompareUh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,1281 @@ | |||
| /* Big parts of this file are copied (with modifications) from | |||
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.
Any reason for this file to be moved? No diff now, all code is like new which makes review harder
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.
There were some odd Cython issues initially, but I'll see if I can move it back.
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.
Done, @1st1, please take another look.
1st1 left a comment
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.
Can we move recordobj.c back where it was?
elprans commented Oct 20, 2025
I couldn't find a way to do it. Cython does not expose a way to plug into its generated module state, so |
1st1 commented Oct 20, 2025
Just for me to review the thing, it's a big file. Were there any changes in it? |
f5bb6f8 to 8eed349Compare…pport The bulk of the changes here is a rewrite of `recordobj.c` to use modern CPython API to properly isolate the module (PEP 489, PEP 573, PEP 630). This, along with Cython flags, enables support for safely importing `asyncpg` in subinterpreters. The `Record` freelist is now thread-specific, so asyncpg should be thread-safe *at the C level*. Support for subinterpreters and freethreading is EXPERIMENTAL.
Uh oh!
There was an error while loading. Please reload this page.
| v_is_tuple=1; | ||
| } | ||
| elseif (ApgRecord_CheckExact(v)){ | ||
| elseif (v_type==state->ApgRecord_Type){ |
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.
I'd keep the ApgRecord_CheckExact macros, just make it accept state as first arg.
asyncpg/protocol/record/recordobj.c Outdated
| cmp=vlen >= wlen; | ||
| break; | ||
| default: | ||
| returnNULL; /* cannot happen */ |
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.
Py_UNREACHABLE();
Uh oh!
There was an error while loading. Please reload this page.
1st1 left a comment
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.
looks ok but please run tests in refleak hunt mode
Uh oh!
There was an error while loading. Please reload this page.
9e42642 into masterUh oh!
There was an error while loading. Please reload this page.
bfontaine commented Nov 21, 2025
When is this expected to be released? |
Enable Python 3.14 with experimental subinterpreter/freethreading support. Improvements ============ * Add Python 3.14 support, experimental subinterpreter/freethreading support (#1279) (by @elprans in 9e42642) * Avoid performing type introspection on known types (#1243) (by @elprans in 5c9986c) * Make `prepare()` not use named statements by default when cache is disabled (#1245) (by @elprans in 5b14653) * Implement connection service file functionality (#1223) (by @AndrewJackson2020 in 1d63bb1) Fixes ===== * Fix multi port connection string issue (#1222) (by @AndrewJackson2020 in 01c0db7) * Avoid leaking connections if _can_use_connection fails (#1269) (by @yuliy-openai in e94302d) Other ===== * Drop support for EOL Python 3.8 (#1281) (by @elprans in 6c2c490)
asyncpg v0.31.0 Enable Python 3.14 with experimental subinterpreter/freethreading support. Improvements ============ * Add Python 3.14 support, experimental subinterpreter/freethreading support (MagicStack#1279) (by @elprans in 9e42642) * Avoid performing type introspection on known types (MagicStack#1243) (by @elprans in 5c9986c) * Make `prepare()` not use named statements by default when cache is disabled (MagicStack#1245) (by @elprans in 5b14653) * Implement connection service file functionality (MagicStack#1223) (by @AndrewJackson2020 in 1d63bb1) Fixes ===== * Fix multi port connection string issue (MagicStack#1222) (by @AndrewJackson2020 in 01c0db7) * Avoid leaking connections if _can_use_connection fails (MagicStack#1269) (by @yuliy-openai in e94302d) Other ===== * Drop support for EOL Python 3.8 (MagicStack#1281) (by @elprans in 6c2c490) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEES/rQWfT9RAppNY3YXEaHeAYth78FAmkk6UMACgkQXEaHeAYt # h7+LBw//fX/3/nHrEUctYR7A/WQqg2oj3nvk10b3OQjzHUGyHq0DhkSC7/H9P0FI # vl0j2n+BfKcKxOw4OgbxDq5fff/a4ScsejVwsKqQEEDH9tiXAL2cIId1yvNWC9hJ # 8WxmkJzbFHdrl1D3/pxUv15UoaMSZD1DtPXaYEupRyEKXVOfQ/ush5GU5M3vA19R # aWrAFtbMd3MMfaBYEO1TQtZNCV3n3Dv8fmIwv8qPbqJt2lsk4HOE8F3Be/RGiaPZ # dI9eGnZ+qmlYC/mZYKNywaBlm4v/hHhuGwSh8WdkY6h4lFkBl8HipuPpoNeWO/fd # k5wl1Q2HA8i2qEokz7EzYPRYjOPZwXphxscRXJQbdlCNyfJ+lPTu3uAQ08RTnoGU # +JROauwgtQknnZEGtRWNerRcbZE1D+SgkLhGkEk6+tcIJ0G2XoCsn7A/u9LMmZuN # 7lcFnLEdDnUSaLx7SZgcbOKP1Acg1W2Vk375JxXrymGqq5FPss8cdg+KOFMNuljT # v/RtKvAP3yXpR448uPQ6M4BNVJ5my3UwdPrHwpGNkSxaqKBGGtryBG4LLw43yPCg # FPFO9P//z+59RsmAvilaOhT/pLhqRvOJTkaUt5bt6Fw+5SzCfNfciNkl4rBC+9EQ # LC/NQmO9cFYlpnO7s3uF0M+JTLV1u0CJp5G5USiQiEU+tVlaH6E= # =bEvL # -----END PGP SIGNATURE----- # gpg: Signature made Tue 25 Nov 2025 12:24:51 AM CET # gpg: using RSA key 4BFAD059F4FD440A69358DD85C468778062D87BF # gpg: Can't check signature: No public key
asyncpg v0.31.0 Enable Python 3.14 with experimental subinterpreter/freethreading support. Improvements ============ * Add Python 3.14 support, experimental subinterpreter/freethreading support (MagicStack#1279) (by @elprans in 9e42642) * Avoid performing type introspection on known types (MagicStack#1243) (by @elprans in 5c9986c) * Make `prepare()` not use named statements by default when cache is disabled (MagicStack#1245) (by @elprans in 5b14653) * Implement connection service file functionality (MagicStack#1223) (by @AndrewJackson2020 in 1d63bb1) Fixes ===== * Fix multi port connection string issue (MagicStack#1222) (by @AndrewJackson2020 in 01c0db7) * Avoid leaking connections if _can_use_connection fails (MagicStack#1269) (by @yuliy-openai in e94302d) Other ===== * Drop support for EOL Python 3.8 (MagicStack#1281) (by @elprans in 6c2c490) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEES/rQWfT9RAppNY3YXEaHeAYth78FAmkk6UMACgkQXEaHeAYt # h7+LBw//fX/3/nHrEUctYR7A/WQqg2oj3nvk10b3OQjzHUGyHq0DhkSC7/H9P0FI # vl0j2n+BfKcKxOw4OgbxDq5fff/a4ScsejVwsKqQEEDH9tiXAL2cIId1yvNWC9hJ # 8WxmkJzbFHdrl1D3/pxUv15UoaMSZD1DtPXaYEupRyEKXVOfQ/ush5GU5M3vA19R # aWrAFtbMd3MMfaBYEO1TQtZNCV3n3Dv8fmIwv8qPbqJt2lsk4HOE8F3Be/RGiaPZ # dI9eGnZ+qmlYC/mZYKNywaBlm4v/hHhuGwSh8WdkY6h4lFkBl8HipuPpoNeWO/fd # k5wl1Q2HA8i2qEokz7EzYPRYjOPZwXphxscRXJQbdlCNyfJ+lPTu3uAQ08RTnoGU # +JROauwgtQknnZEGtRWNerRcbZE1D+SgkLhGkEk6+tcIJ0G2XoCsn7A/u9LMmZuN # 7lcFnLEdDnUSaLx7SZgcbOKP1Acg1W2Vk375JxXrymGqq5FPss8cdg+KOFMNuljT # v/RtKvAP3yXpR448uPQ6M4BNVJ5my3UwdPrHwpGNkSxaqKBGGtryBG4LLw43yPCg # FPFO9P//z+59RsmAvilaOhT/pLhqRvOJTkaUt5bt6Fw+5SzCfNfciNkl4rBC+9EQ # LC/NQmO9cFYlpnO7s3uF0M+JTLV1u0CJp5G5USiQiEU+tVlaH6E= # =bEvL # -----END PGP SIGNATURE----- # gpg: Signature made Tue 25 Nov 2025 12:24:51 AM CET # gpg: using RSA key 4BFAD059F4FD440A69358DD85C468778062D87BF # gpg: Can't check signature: No public key
The bulk of the changes here is a rewrite of
recordobj.cto use modernCPython API to properly isolate the module (PEP 489, PEP 573, PEP 630).
This, along with Cython flags, enables support for safely importing
asyncpgin subinterpreters. TheRecordfreelist is nowthread-specific, so asyncpg should be thread-safe at the C level.
Support for subinterpreters and freethreading is EXPERIMENTAL.