STINNER Victor <vstin...@python.org> added the comment:

I plan to merge my PR 17340 at the end of week to not miss Python 3.9 feature 
freeze deadline, unless someone speaks up and find a good reason to not merge 
this PR. The PR adds a public C API PyInterpreterState_SetEvalFrameFunc() and 
now pass tstate to the frame evaluation function.

--

Mark Shannon is against the idea of providing a way to set the frame evaluation 
function (PEP 523), but Dino Viehland, Eric Snow, Brett Cannon and me want to 
provide a C API for that.

--

I propose to properly fix this issue in Python 3.9:

* Add a public C API to get and set the frame evaluation function
* Pass tstate to this frame evaluation function

Pass tstate is a backward incompatible change. But it's unclear to me if its 
API was part of the "public" C API in Python 3.7. In Python 3.8, 
PyInterpreterState structure moved to the internal C API which is clearly 
excluded from backward compatibility warranties of the public C API.

Anyway, I expect that they are less than 10 projects in the world which use the 
frame evaluation function, which it should be doable to update all of them to 
support the C API for Python 3.9 that I'm proposing.

--

> This is no longer possible because in 3.8 the PyInterpreterState is opaque, 
> so, Py_BUILD_CORE_MODULE needs to be defined defined and 
> "internal/pycore_pystate.h" must be included to set 
> PyInterpreterState.eval_frame.

The status quo is that Python 3.8.0, 3.8.1 and 3.8.2 have been released with 
that. If someone wants to support "Python 3.8", using Py_BUILD_CORE_MODULE to 
access the internal C API is the way to go. If we wanted to add a public C API 
in Python 3.8, IMHO we had to do it *before Python 3.8.0 release. Now it's way 
too late.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38500>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to