Skip to content
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

Fix _PyFrameEvalFunction receives an _PyInterpreterFrame since Python 3.11 #3500

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

ecarrara
Copy link
Contributor

@ecarrara ecarrara commented Oct 7, 2023

In Python 3.11 the _PyFrameEvalFunction receives a _PyInterpreterFrame opaque struct.

Python 3.11.0 (alpha 7) changelog:

...
bpo-46850: Move the private _PyFrameEvalFunction type, and private _PyInterpreterState_GetEvalFrameFunc() and _PyInterpreterState_SetEvalFrameFunc() functions to the internal C API. The _PyFrameEvalFunction callback function type now uses the _PyInterpreterFrame type which is part of the internal C API. Patch by Victor Stinner.
bpo-46850: Move the private undocumented _PyEval_EvalFrameDefault() function to the internal C API. The function now uses the _PyInterpreterFrame type which is part of the internal C API. Patch by Victor Stinner.
...

https://docs.python.org/3/whatsnew/changelog.html#id143

@ecarrara ecarrara changed the title _PyFrameEvalFunction receives an _PyInterpreterFrame since Python 3.11 Fix _PyFrameEvalFunction receives an _PyInterpreterFrame since Python 3.11 Oct 7, 2023
Copy link
Member

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Don't worry about the CI failures; you'll need to rebase once #3498 lands.

pyo3-ffi/src/cpython/pystate.rs Outdated Show resolved Hide resolved
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main should now be good again if you want to rebase.

Comment on lines 5 to 6
#[cfg(any(PyPy, Py_3_11))]
opaque_struct!(_PyInterpreterFrame);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like (at least on CPython main) that this symbol resides in cpython/pyframe.h. Can you please create the corresponding .rs file and place this there?

pyo3-ffi/src/cpython/ceval.rs Outdated Show resolved Hide resolved
@ecarrara ecarrara requested a review from mejrs October 9, 2023 17:32
@@ -0,0 +1,2 @@
#[cfg(any(PyPy, Py_3_11))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this available in PyPy? I couldn't find anything about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find it either 😅

I've added #[cfg(not(PyPy))] to the pub(crate) mod pyframe; line on src/cpython/mod.rs because PyPy does not have something like "pyframe.h" in their source code.

Commit: 4931b00

Copy link
Member

@mejrs mejrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing, can you squash the commits please? 🙂

@davidhewitt davidhewitt added this pull request to the merge queue Oct 10, 2023
Merged via the queue into PyO3:main with commit 80bbb30 Oct 10, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants