On 8/13/2021 1:24 PM, Guido van Rossum wrote:
In 3.11 we're changing a lot of details about code objects. Part of this
is the "Faster CPython" work, part of it is other things (e.g. PEP 657
-- Fine Grained Error Locations in Tracebacks).
As a result, the set of fields of the code object is changing. This is
fine, the structure is part of the internal API anyway.
But there's a problem with two public API functions, PyCode_New() and
PyCode_NewWithPosArgs(). As we have them in the main (3.11) branch,
their signatures are incompatible with previous versions, and they have
to be since the set of values needed to create a code object is
different. (The types.CodeType constructor signature is also changed,
and so is its replace() method, but these aren't part of any stable API).
Unfortunately, PyCode_New() and PyCode_NewWithPosArgs() are part of the
PEP 387 stable ABI. What should we do?
PEP 387 is Backwards Compatibility Policy
https://www.python.org/dev/peps/pep-0387/
Did you mean PEP 384 -- Defining a Stable ABI
https://www.python.org/dev/peps/pep-0384/
How are PyCode_xxx included? 384 defines code objects as 'internal
objects'. "In some cases, the incompatibilities only affect internal
objects of the interpreter, such as frame or code objects." And Firefox
does not find 'pycode'.
A. We could deprecate them, keep (restore) their old signatures, and
create crippled code objects (no exception table, no endline/column
tables, qualname defaults to name).
B. We could deprecate them, restore the old signatures, and always raise
an error when they are called.
These seem pretty useless.
C. We could just delete them.
D. We could keep them, with modified signatures, and to heck with ABI
compatibility for these two.
E. We could get rid of PyCode_NewWithPosArgs(), update PyCode() to add
the posonlyargcount (which is the only difference between the two), and
d*mn the torpedoes.
F. Like (E), but keep PyCode_NewWithPosArgs() as an alias for
PyCode_New() (and deprecate it).
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/3OXTGNT5DTBJBWF7ZXLQB22NYNZWHJI7/
Code of Conduct: http://python.org/psf/codeofconduct/