Python 3.15b1 ABI support#6014
Conversation
|
I added 3.15 and 3.15t CI to the PR CI builds and the new CI is passing. I just rebased and squashed to get a better coverage report. (EDIT: I guess it makes sense the coverage CI is failing, given the new untested FFI definitions) That said, this is definitely ready for review. Please let me know if you'd prefer I do this in smaller chunks. |
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, overall looks good to me, a few small suggestions.
| if val >= 0 && val <= u16::MAX as c_int { | ||
| val as u16 | ||
| } else { | ||
| panic!("Slot ID out of range for u16!"); |
There was a problem hiding this comment.
| panic!("Slot ID out of range for u16!"); | |
| panic!("Slot ID out of range for u16"); |
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
There was a problem hiding this comment.
Maybe it's just me, but perhaps we should maintain a PyO3-specific fork of bindgen to output better type names for anonymous unions and other kludges with for_all_fields...
|
OK, ready for another review pass. |
| pub const fn PySlot_STATIC_DATA(NAME: c_int, VALUE: *mut c_void) -> PySlot { | ||
| PySlot { | ||
| sl_id: safe_cast_c_int_to_u16(NAME), | ||
| sl_flags: PySlot_STATIC, | ||
| anon1: _anon_union_32b { sl_reserved: 0 }, | ||
| anon2: _anon_union_64b { sl_ptr: VALUE }, | ||
| } |
There was a problem hiding this comment.
| pub const fn PySlot_STATIC_DATA(NAME: c_int, VALUE: *mut c_void) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_STATIC, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { sl_ptr: VALUE }, | |
| } | |
| pub const fn PySlot_STATIC_DATA(NAME: c_int, VALUE: std::ptr::NonNull<*mut c_void>) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_STATIC, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { unsafe { | |
| sl_ptr: (*VALUE).as_ptr() | |
| } }, | |
| } |
| pub const fn PySlot_PTR(NAME: c_int, VALUE: *mut c_void) -> PySlot { | ||
| PySlot { | ||
| sl_id: safe_cast_c_int_to_u16(NAME), | ||
| sl_flags: PySlot_INTPTR, | ||
| anon1: _anon_union_32b { sl_reserved: 0 }, | ||
| anon2: _anon_union_64b { sl_ptr: VALUE }, | ||
| } |
There was a problem hiding this comment.
| pub const fn PySlot_PTR(NAME: c_int, VALUE: *mut c_void) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_INTPTR, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { sl_ptr: VALUE }, | |
| } | |
| pub const fn PySlot_PTR(NAME: c_int, VALUE: std::ptr::NonNull<*mut c_void>) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_INTPTR, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { unsafe { | |
| sl_ptr: (*VALUE).as_ptr() | |
| } }, | |
| } |
| pub const fn PySlot_PTR_STATIC(NAME: c_int, VALUE: *mut c_void) -> PySlot { | ||
| PySlot { | ||
| sl_id: safe_cast_c_int_to_u16(NAME), | ||
| sl_flags: PySlot_INTPTR | PySlot_STATIC, | ||
| anon1: _anon_union_32b { sl_reserved: 0 }, | ||
| anon2: _anon_union_64b { sl_ptr: VALUE }, | ||
| } | ||
| } |
There was a problem hiding this comment.
| pub const fn PySlot_PTR_STATIC(NAME: c_int, VALUE: *mut c_void) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_INTPTR | PySlot_STATIC, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { sl_ptr: VALUE }, | |
| } | |
| } | |
| pub const fn PySlot_PTR_STATIC(NAME: c_int, VALUE: std::ptr::NonNull<*mut c_void>) -> PySlot { | |
| PySlot { | |
| sl_id: safe_cast_c_int_to_u16(NAME), | |
| sl_flags: PySlot_INTPTR | PySlot_STATIC, | |
| anon1: _anon_union_32b { sl_reserved: 0 }, | |
| anon2: _anon_union_64b { unsafe { | |
| sl_ptr: (*VALUE).as_ptr() | |
| } }, | |
| } | |
| } |
| pub const fn PySlot_DATA(NAME: c_int, VALUE: *mut c_void) -> PySlot { | ||
| PySlot { | ||
| sl_id: safe_cast_c_int_to_u16(NAME), | ||
| sl_flags: PySlot_INTPTR, | ||
| anon1: _anon_union_32b { sl_reserved: 0 }, | ||
| anon2: _anon_union_64b { sl_ptr: VALUE }, | ||
| } |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
I'm not sure whether it's correct to work around clippy warning that |
towards fixing #6012.
Adds support for the PEP 820 PySlot API, updates the PEP 793 implementation, and adds the critical section API to the limited API. Also fixes a small change to PyTypeObject that crept in since alpha8.
Claude helped a bit for code review and to figure out the
PySlot_FUNCand the__pyo3_pymodexportmacros.Ping @bschoenmaeckers because you asked in the issue what this would look like.