-
Notifications
You must be signed in to change notification settings - Fork 136
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
Initial support for Python 3.11 beta #279
Conversation
If you want, you are free to merge right now. I just figured we'd wait until 3.11 was more developed..... |
We should wait for the RC which typically is ABI-compatible with the final release. |
This is obviously experimental but it works okay. MAin difference is that frame object is now private (and lazy loaded) and the internal ordering of code objects has completely changed as well
The ordering of the fields has completely changed, so we give it a different definition.
461100f
to
33cd7d3
Compare
I agree. We should wait to the RC before pulling this.
Done! Tests still appear to be failing though. This fixes most of the tests. However there is something about "ast-json" on 2.7 nightly |
// | ||
// the justification for the reordering was "optimization" | ||
pub struct PyCodeObject { | ||
pub ob_base: PyObject, |
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.
Shouldn't this be PyVarObject?
pub co_names: *mut PyObject, | ||
pub co_exceptiontable: *mut PyObject, | ||
pub co_flags: c_int, | ||
pub co_warmup: c_int, |
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.
The fields around here changed since you created this pull request
pub co_name: *mut PyObject, | ||
pub co_qualname: *mut PyObject, | ||
pub co_linetable: *mut PyObject, | ||
pub co_weakreflist: *mut PyObject, |
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.
More fields were inserted here
@@ -169,6 +220,7 @@ pub unsafe fn PyCode_Check(op: *mut PyObject) -> c_int { | |||
} | |||
|
|||
#[inline] | |||
#[cfg(not(Py_3_11))] // TODO: Implemengt again (fields are private) |
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.
?
@@ -21,6 +21,9 @@ extern "C" { | |||
arg2: *mut *mut PyObject, | |||
arg3: *mut *mut PyObject, | |||
) -> (); | |||
#[cfg(Py_3_11)] | |||
pub fn PyErr_GetHandledException() -> *mut PyObject; | |||
pub fn PyErr_SetHandledException(exc: *mut PyObject); |
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.
Missing #[cfg(Py_3_11)]
?
I'm continuing work on python 3.11 support on https://github.com/dgrunwald/rust-cpython/tree/py3.11 |
Awesome! Thanks 👍 |
This is obviously experimental but it works okay.
All the tests pass and the example prints the following:
I figure it's best to be proactive with these change, so that way we are ready as soon as 3.11 proper is released (October I think).
MAin difference in 3.11 that frame object is now private (and lazy loaded).
This results in a performance improvement but makes it harder for debuggers.
Also the internal ordering of code objects has completely changed as well.