-
Notifications
You must be signed in to change notification settings - Fork 966
Python 3.15b1 ABI support #6014
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
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
117205b
Add support for the 3.15 ABI as of 3.15.0b1
ngoldbaum a3c0ac8
Apply suggestions from code review
ngoldbaum f94aa5b
apply trivial suggestions from david
ngoldbaum 79f71d9
apply remaining suggestions
ngoldbaum 24935ba
Merge branch 'main' into pep-820
ngoldbaum cab5e00
mark PySlot_FUNC as unsafe to fix clippy
ngoldbaum 75a3bab
do it without unsafe
ngoldbaum 97a3e96
fix sequential example for Python 3.15
ngoldbaum 12e51ab
simplify SLOTS_LEN definition in FFI example
ngoldbaum 517c560
delete dead code
ngoldbaum 43ce648
Apply comments from David
ngoldbaum 67d947e
gate on rustc version
ngoldbaum 651cf37
fix clippy
ngoldbaum e87f566
spelling
ngoldbaum bc0ed25
Merge branch 'main' into pep-820
ngoldbaum 56c87b0
fix ffi-check
ngoldbaum 26809b9
fix FFI doctest on Python 3.8
ngoldbaum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| * Added support for Python 3.15.0b1. | ||
| * Added FFI bindings for the PEP 820 PySlot C API. | ||
| * Added bindings for the critical section API in the limited API on Python 3.15 | ||
| and newer. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Updated FFI bindings and module initialization to use PEP 820 PySlot API. |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,11 @@ | ||
| #[cfg(any(Py_3_14, Py_GIL_DISABLED))] | ||
| use crate::PyMutex; | ||
| use crate::PyObject; | ||
|
|
||
| #[repr(C)] | ||
| #[cfg(Py_GIL_DISABLED)] | ||
| pub struct PyCriticalSection { | ||
| _cs_prev: usize, | ||
| _cs_mutex: *mut PyMutex, | ||
| } | ||
|
|
||
| #[repr(C)] | ||
| #[cfg(Py_GIL_DISABLED)] | ||
| pub struct PyCriticalSection2 { | ||
| _cs_base: PyCriticalSection, | ||
| _cs_mutex2: *mut PyMutex, | ||
| } | ||
|
|
||
| #[cfg(not(Py_GIL_DISABLED))] | ||
| opaque_struct!(pub PyCriticalSection); | ||
|
|
||
| #[cfg(not(Py_GIL_DISABLED))] | ||
| opaque_struct!(pub PyCriticalSection2); | ||
| use crate::{PyCriticalSection, PyCriticalSection2}; | ||
|
|
||
| extern_libpython! { | ||
| pub fn PyCriticalSection_Begin(c: *mut PyCriticalSection, op: *mut PyObject); | ||
| #[cfg(Py_3_14)] | ||
| pub fn PyCriticalSection_BeginMutex(c: *mut PyCriticalSection, m: *mut PyMutex); | ||
| pub fn PyCriticalSection_End(c: *mut PyCriticalSection); | ||
| pub fn PyCriticalSection2_Begin(c: *mut PyCriticalSection2, a: *mut PyObject, b: *mut PyObject); | ||
| #[cfg(Py_3_14)] | ||
| pub fn PyCriticalSection2_BeginMutex( | ||
| c: *mut PyCriticalSection2, | ||
| m1: *mut PyMutex, | ||
| m2: *mut PyMutex, | ||
| ); | ||
| pub fn PyCriticalSection2_End(c: *mut PyCriticalSection2); | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #[cfg(any(all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), Py_3_15,))] | ||
| use crate::PyMutex; | ||
| #[cfg(any(all(Py_GIL_DISABLED, Py_3_13), Py_3_15))] | ||
| use crate::PyObject; | ||
|
|
||
| #[cfg(all(Py_LIMITED_API, Py_3_13, not(Py_3_15)))] | ||
| opaque_struct!(pub PyMutex); | ||
|
|
||
| #[cfg(any(all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), Py_3_15,))] | ||
| #[repr(C)] | ||
| pub struct PyCriticalSection { | ||
| _cs_prev: usize, | ||
| _cs_mutex: *mut PyMutex, | ||
| } | ||
|
|
||
| #[cfg(any(all(Py_GIL_DISABLED, Py_3_13, not(Py_LIMITED_API)), Py_3_15,))] | ||
| #[repr(C)] | ||
| pub struct PyCriticalSection2 { | ||
| _cs_base: PyCriticalSection, | ||
| _cs_mutex2: *mut PyMutex, | ||
| } | ||
|
|
||
| #[cfg(all(not(Py_GIL_DISABLED), Py_3_13, not(Py_3_15), not(Py_LIMITED_API)))] | ||
| opaque_struct!(pub PyCriticalSection); | ||
| #[cfg(all(not(Py_GIL_DISABLED), Py_3_13, not(Py_3_15), not(Py_LIMITED_API)))] | ||
| opaque_struct!(pub PyCriticalSection2); | ||
|
|
||
| #[cfg(any(all(Py_GIL_DISABLED, Py_3_13), Py_3_15))] | ||
| extern_libpython! { | ||
| pub fn PyCriticalSection_Begin(c: *mut PyCriticalSection, op: *mut PyObject); | ||
| pub fn PyCriticalSection_End(c: *mut PyCriticalSection); | ||
| pub fn PyCriticalSection2_Begin(c: *mut PyCriticalSection2, a: *mut PyObject, b: *mut PyObject); | ||
| pub fn PyCriticalSection2_End(c: *mut PyCriticalSection2); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Maybe it's just me, but perhaps we should maintain a PyO3-specific fork of
bindgento output better type names for anonymous unions and other kludges withfor_all_fields...