On Fri, Aug 13, 2021 at 11:29 AM Guido van Rossum <gu...@python.org> wrote: > If these weren't part of the stable ABI, I'd choose (E).
They aren't in the stable ABI (or limited API). Instead, they are part of the broader public API (declared in Include/cpython/code.h, along with "struct PyCodeObject" and others). FWIW, there is actually very little API related to PyCodeObject that is in the limited API: * Include/code.h:typedef struct PyCodeObject PyCodeObject; * Include/genobject.h: PyCodeObject *prefix##_code; * Include/pyframe.h:PyAPI_FUNC(PyCodeObject *) PyFrame_GetCode(PyFrameObject *frame); All that said, the issue of compatibility remains. I mostly agree with Guido's analysis and his choice of (E), as long as it's appropriately documented as unstable. However, I'd probably pick (C) with a caveat. We already have a classification for this sort of unstable API: "internal". Given how code objects are so coupled to the CPython internals, I suggest that most API related to PyCodeObject belongs in the internal API (in Include/internal/pycore_code.h) and thus moved out of the public API. Folks that are creating code objects manually via the C-API are probably already doing low-level stuff that requires other "internal" API (via Py_BUILD_CORE, etc.). Otherwise they should use types.CodeType instead. Making that change would naturally include dropping PyCode_New() and PyCode_NewWithPosArgs(), as described in (C). However, we already have _PyCode_New() in the internal API. (It is slightly different but effectively equivalent.) We could either drop the underscore on _PyCode_New() or move the existing PyCode_NewWithPosArgs() (renamed to PyCode_New) to live beside it. -eric _______________________________________________ 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/KWWRLL56EI2S5BVADKMDCG4UED76GXXG/ Code of Conduct: http://python.org/psf/codeofconduct/