-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Expose _PyInterpreterFrame_GetLine in the private API #96803
Comments
CC @mdboom |
I see your point, but I don't think that |
I started exposing As there can be arbitrary logic in |
It still think that the pair of If you think that doing that would be too disruptive for 3.11, we can add them for 3.12, and just expose |
In 3.12 they are already exposed if the user calls Exposing |
All that does is expose the existence of a field call In general, |
Ok, I am convinced. I will expose |
Ah, turns out this has changed in ef6a482 and now is a macro on 3.11 as well. This means we can backport the 3.12 change |
…ymbol Signed-off-by: Pablo Galindo <[email protected]>
@markshannon I had another idea. Maybe we should expose the API to transform the interpreter frame into a python object. At that point you can do whatever you want with it. What do you think? |
Doesn't that undermine the whole point as using the |
…opaque for users of PEP 523. (GH-96849)
gh-96849 added new APIs, but no documentation was added. Mentioning it here, so we don't forget before we close this issue. |
* main: pythongh-99113: Add PyInterpreterConfig.own_gil (pythongh-104204) pythongh-104146: Remove unused var 'parser_body_declarations' from clinic.py (python#104214) pythongh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (pythongh-104205) pythongh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (pythongh-104148) pythongh-99113: Share the GIL via PyInterpreterState.ceval.gil (pythongh-104203) pythonGH-100479: Add `pathlib.PurePath.with_segments()` (pythonGH-103975) pythongh-69152: Add _proxy_response_headers attribute to HTTPConnection (python#26152) pythongh-103533: Use PEP 669 APIs for cprofile (pythonGH-103534) pythonGH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (pythonGH-96849)
… less opaque for users of PEP 523. (pythonGH-96849)
Note that even unstable API needs tests as well as documentation. |
…GH-104211) Weaken contract of PyUnstable_InterpreterFrame_GetCode to return PyObject*.
* main: pythongh-74690: Don't set special protocol attributes on non-protocol subclasses of protocols (python#104622) pythongh-104623: Update Windows installer to use SQLite 3.42.0 (python#104625) pythongh-104050: Add more type annotations to Argument Clinic (python#104628) pythongh-104629: Don't skip test_clinic if _testclinic is missing (python#104630) pythongh-104549: Set __module__ on TypeAliasType (python#104550) pythongh-104050: Improve some typing around `default`s and sentinel values (python#104626) pythongh-104146: Remove unused vars from Argument Clinic (python#104627) pythongh-104615: don't make unsafe swaps in apply_static_swaps (python#104620) pythonGH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (pythonGH-104565) pythonGH-96803: Document and test new unstable internal frame API functions (pythonGH-104211) pythonGH-104580: Don't cache eval breaker in interpreter (pythonGH-104581)
Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "#include <Python.h>".
Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "#include <Python.h>".
…7188) Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "#include <Python.h>".
pythonGH-107188) Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "GH-include <Python.h>". (cherry picked from commit 837fa5c) Co-authored-by: Victor Stinner <[email protected]>
….h (GH-107188) (#107195) GH-96803: Move PyUnstable_InterpreterFrame_GetCode() to Python.h (GH-107188) Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "GH-include <Python.h>". (cherry picked from commit 837fa5c) Co-authored-by: Victor Stinner <[email protected]>
python#107188) Declare the following 3 PyUnstable functions in Include/cpython/pyframe.h rather than Include/cpython/frameobject.h, so they are now provided by the standard "#include <Python.h>".
In 3.11 we are using now an opaque pointer to
_PyInterpreterFrame
in the eval function. The problem is that for PEP 523's APIs, we changed the type of_PyFrameEvalFunction
to bePyObject *(*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
but there is no way to do anything with_PyInterpreterFrame
because is opaque. Even if the extension definesPY_BUILD_CORE
the symbols are not exposed in the executable/libpython, which means that including the headers is insufficient.This is a problem because it really limits what users of PEP 523 can do with the frame object that they receive, even if is opaque. Most profilers using PEP 523 API do it for speed reasons and the only thing they need is to get the line number, but that is now impossible because the pointer is opaque and we don't offer any exposed APIs.
Linked PRs
The text was updated successfully, but these errors were encountered: