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

[C API] Move PyFrame_GetBack() function to <Python.h> #93937

Open
vstinner opened this issue Jun 17, 2022 · 1 comment
Open

[C API] Move PyFrame_GetBack() function to <Python.h> #93937

vstinner opened this issue Jun 17, 2022 · 1 comment
Labels
expert-C-API type-bug

Comments

@vstinner
Copy link
Member

@vstinner vstinner commented Jun 17, 2022

Currently, getter functions of a Python frame object (PyFrameObject) are only accessible if the frameobject.h header is included explicitly. It's not documented in the frame doc: https://docs.python.org/dev/c-api/frame.html

In Python 3.11, the PyFrameObject structure was moved to the internal C API. Third party C extensions now must only use getter functions, as explained in What's New in Python 3.11: https://docs.python.org/dev/whatsnew/3.11.html#id6

Problem: functions like PyFrame_GetBack() requires to include frameobject.h. I propose to move these getter functions to Python.h (to pyframe.h in practice) to make these functions less special.

@vstinner vstinner added type-bug expert-C-API labels Jun 17, 2022
vstinner added a commit to vstinner/cpython that referenced this issue Jun 17, 2022
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 17, 2022
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.
vstinner added a commit that referenced this issue Jun 19, 2022
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 19, 2022
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.

(cherry picked from commit 27b9894)
vstinner added a commit to vstinner/cpython that referenced this issue Jun 20, 2022
On Windows, PyOS_StdioReadline() now gets
PyConfig.legacy_windows_stdio from _PyOS_ReadlineTState, rather than
using the deprecated global Py_LegacyWindowsStdioFlag variable.

Fix also a compiler warning in Py_SetStandardStreamEncoding().
vstinner added a commit that referenced this issue Jun 20, 2022
Move the follow functions and type from frameobject.h to pyframe.h,
so the standard <Python.h> provide frame getter functions:

* PyFrame_Check()
* PyFrame_GetBack()
* PyFrame_GetBuiltins()
* PyFrame_GetGenerator()
* PyFrame_GetGlobals()
* PyFrame_GetLasti()
* PyFrame_GetLocals()
* PyFrame_Type

Remove #include "frameobject.h" from many C files. It's no longer
needed.

(cherry picked from commit 27b9894)
vstinner added a commit that referenced this issue Jun 20, 2022
…4024)

On Windows, PyOS_StdioReadline() now gets
PyConfig.legacy_windows_stdio from _PyOS_ReadlineTState, rather than
using the deprecated global Py_LegacyWindowsStdioFlag variable.

Fix also a compiler warning in Py_SetStandardStreamEncoding().
@vstinner
Copy link
Member Author

@vstinner vstinner commented Jun 20, 2022

Done:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expert-C-API type-bug
Projects
None yet
Development

No branches or pull requests

1 participant