Mark Shannon <m...@hotpy.org> added the comment:

I know PyCode_NewWithPosOnlyArgs is declared as "PyAPI_FUNC" but that can't 
make it part of the ABI unless it has stable behavior.
It can't have stable behavior because its inputs are complex, undefined, have 
altered semantics and are interlinked in complex ways.

Passing the same arguments to PyCode_NewWithPosOnlyArgs for both 3.9 and 3.10 
will cause one or other version to crash (interpreter crash, not just program 
crash).


We need to stop adding "PyAPI_FUNC" to everything.
Adding a PyAPI_FUNC does not magically make for ABI compatibility, there is a 
lot more to it than that.

The only sane ways to construct a code object are to load it from disk, to 
compile an AST, or to use
codeobject.replace(). Any purported ABI compatibility claims are just 
misleading and a trap.


I can revert the API changes and add a new function, but I think that is 
dangerously misleading. A compilation error is preferable to an interpreter 
crash.

----------

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

Reply via email to