gh-140550: Docs notes for PEP 793 by encukou · Pull Request #151661 · python/cpython
Conversation
Here are a few more things for the docs of PEP 793:
- Update slot-related advice in the
abi3tmigration guide - Note that inittab doesn't use the PEP 793 API
- Add caveats for code in the export function
- Fix class name in the
PyObject_GetTypeData/Py_TYPEwarning
| If you need to use any Python C API, it is recommended to call | ||
| :c:func:`PyABIInfo_Check` first to raise an exception, | ||
| rather than crash, in common cases of ABI mismatch. | ||
| Also, note that in :term:`free-threaded <free threading>` builds the export |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a :term:`free-threaded build` term for this.
Comment on lines +110 to +111
| function may be called without the :term:`GIL` held even if the extension | ||
| specifies that the GIL is required. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify what this means? "Calling with the GIL held" sounds like the old terminology for calling without an attached thread state. If export functions just need synchronization, then let's just say that.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really the GIL here: Py_MOD_GIL_USED (or leaving Py_mod_gil out) only takes effect when Python sees it, after the hook returns.
Agree that it's confusing (and I missed a caveat, too!)
I'll expand this.