Skip to main content

Module compat

Module compat 

Source
Expand description

C API Compatibility Shims

Some CPython C API functions added in recent versions of Python are inherently safer to use than older C API constructs. This module exposes functions available on all Python versions that wrap the old C API on old Python versions and wrap the function directly on newer Python versions.

Structs§

PyBytesWriterNeither Py_3_15 nor Py_LIMITED_API

Functions§

PyBytesWriter_Create⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_Discard⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_Finish⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_FinishWithSize⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_GetData⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_GetSize⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyBytesWriter_Resize⚠docsrs or not (Py_3_15 and non-Py_LIMITED_API)
PyDict_GetItemRef⚠Py_3_13
PyDict_SetDefaultRef⚠Py_3_13 and (Py_3_15 or non-Py_LIMITED_API)
PyImport_AddModuleRef⚠Py_3_13
PyIter_NextItem⚠Py_3_14
PyList_Clear⚠Py_3_13
PyList_Extend⚠Py_3_13
PyList_GetItemRef⚠Py_3_13
PyModule_Add⚠Py_3_13
PyModule_AddObjectRef⚠Py_3_10
PyObject_CallMethodNoArgs⚠Non-PyPy
PyObject_CallNoArgs⚠(Py_3_10 or non-Py_LIMITED_API) and non-PyPy
PyObject_GetOptionalAttr⚠Py_3_13
PyObject_HasAttrWithError⚠Py_3_13
PyThreadState_GetUnchecked⚠Py_3_13
PyWeakref_GetRef⚠Py_3_13
Py_HashBuffer⚠Py_3_14
Py_NewRef⚠Py_3_10 and (PyPy or non-Py_LIMITED_API)
Py_XNewRef⚠Py_3_10 and (PyPy or non-Py_LIMITED_API)
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here