Changelog¶
2026-10-12: Add functions:
PyEval_GetFrameBuiltins()PyEval_GetFrameGlobals()PyEval_GetFrameLocals()
2026-10-12: Delete 5
Borrowfunctions which were specific to pythoncapi-compat and only used by the removed scriptupgrade_pythoncapi.py:_Py_StealRef()_Py_XStealRef()_PyThreadState_GetFrameBorrow()_PyFrame_GetCodeBorrow()and_PyFrame_GetBackBorrow().2026-10-11: Remove the
upgrade_pythoncapi.pyscript.2026-10-10: Add
PyObject_GenericHash()andPyUnicodeWriter_WriteUCS4()functions. runtests.py now runs tests in parallel.2026-10-08: Add support for the limited C API 3.2.
2026-10-08: Add functions:
PyImport_ImportModuleAttr()PyImport_ImportModuleAttrString()PyType_GetFullyQualifiedName()PyType_GetModuleName()PyType_GetName()PyType_GetQualName()
2026-10-04: Add support for the limited C API (
Py_LIMITED_API).2026-09-23:
PyUnstable_Object_IsUniquelyReferenced(),PyUnstable_TryIncRef()andPyUnstable_EnableTryIncRef()are no longer available on PyPy.Py_REFCNT()semantics is different on PyPy.2026-09-22: Add support for PyPy3.12 v8.0.0, which provides
PyFrame_GetCode()andPyInterpreterState_Get().2026-09-07: Remove code to support Python 2.7, Python 3.5 and PyPy for Python 2.7 (“pypy2”). Python 2.7 was no longer supported since August 2023. Python 3.5 was no longer supported since October 2024.
2026-02-12: Add functions:
PyUnstable_SetImmortal()
2025-10-14: Add functions:
PyTuple_FromArray()PyUnstable_Unicode_GET_CACHED_HASH()
2025-09-18: Add PEP 782 functions:
PyBytesWriter_Create()PyBytesWriter_Discard()PyBytesWriter_Finish()PyBytesWriter_FinishWithPointer()PyBytesWriter_FinishWithSize()PyBytesWriter_Format()PyBytesWriter_GetData()PyBytesWriter_GetSize()PyBytesWriter_Grow()PyBytesWriter_GrowAndUpdatePointer()PyBytesWriter_Resize()PyBytesWriter_WriteBytes()
2025-09-01: Add
PyUnstable_Object_IsUniquelyReferenced()function.2025-06-09: Add
PyUnicodeWriter_WriteASCII()function.2025-06-03: Add functions:
PySys_GetAttr()PySys_GetAttrString()PySys_GetOptionalAttr()PySys_GetOptionalAttrString()
2025-01-19: Add
PyConfig_Get()functions.2025-01-06: Add
Py_fopen()andPy_fclose()functions.2024-12-16: Add
structmember.hconstants:Py_T_BOOLPy_T_BYTEPy_T_CHARPy_T_DOUBLEPy_T_FLOATPy_T_INTPy_T_LONGLONGPy_T_LONGPy_T_OBJECT_EXPy_T_PYSSIZETPy_T_SHORTPy_T_STRING_INPLACEPy_T_STRINGPy_T_UBYTEPy_T_UINTPy_T_ULONGLONGPy_T_ULONGPy_T_USHORT_Py_T_NONE_Py_T_OBJECTPy_AUDIT_READPy_READONLY_Py_WRITE_RESTRICTED
2024-12-13: Add functions and structs:
PyLongLayoutPyLong_GetNativeLayout()PyLongExportPyLong_Export()PyLong_FreeExport()PyLongWriterPyLongWriter_Create()PyLongWriter_Finish()PyLongWriter_Discard()
2024-11-12: Add functions:
PyLong_IsPositive()PyLong_IsNegative()PyLong_IsZero()
2024-10-09: Add functions:
PyBytes_Join()PyIter_NextItem()PyLong_AsInt32()PyLong_AsInt64()PyLong_AsUInt32()PyLong_AsUInt64()PyLong_FromInt32()PyLong_FromInt64()PyLong_FromUInt32()PyLong_FromUInt64()PyUnicode_Equal()Py_HashBuffer()
2024-07-18: Add functions:
PyUnicodeWriter_Create()PyUnicodeWriter_Discard()PyUnicodeWriter_Finish()PyUnicodeWriter_WriteChar()PyUnicodeWriter_WriteUTF8()PyUnicodeWriter_WriteStr()PyUnicodeWriter_WriteRepr()PyUnicodeWriter_WriteSubstring()PyUnicodeWriter_WriteWideChar()PyUnicodeWriter_Format()
2024-06-03: Add
PyLong_GetSign().2024-04-23: Drop Python 3.5 support. It cannot be tested anymore (pip fails).
2024-04-02: Add
PyDict_SetDefaultRef()function.2024-03-29: Add
PyList_GetItemRef()function.2024-03-21: Add functions:
Py_GetConstant()Py_GetConstantBorrowed()
2024-03-09: Add hash constants:
PyHASH_BITSPyHASH_IMAGPyHASH_INFPyHASH_MODULUS
2024-02-20: Add PyTime API:
PyTime_ttypePyTime_MINandPyTime_MAXconstantsPyTime_AsSecondsDouble()PyTime_Monotonic()PyTime_PerfCounter()PyTime_Time()
2023-12-15: Add function
Py_HashPointer().2023-11-14: Add functions:
PyDict_Pop()PyDict_PopString()
2023-11-13: Add functions:
PyList_Extend()PyList_Clear()
2023-10-04: Add functions:
PyUnicode_EqualToUTF8()PyUnicode_EqualToUTF8AndSize()
2023-10-03: Add functions:
PyObject_VisitManagedDict()PyObject_ClearManagedDict()PyThreadState_GetUnchecked()
2023-09-29: Add functions:
PyMapping_HasKeyWithError()PyMapping_HasKeyStringWithError()PyObject_HasAttrWithError()PyObject_HasAttrStringWithError()
2023-08-25: Add
PyDict_ContainsString()andPyLong_AsInt()functions.2023-08-21: Remove support for Python 2.7, Python 3.4 and older.
2023-08-16: Add
Py_IsFinalizing()function.2023-07-21: Add
PyDict_GetItemRef()function.2023-07-18: Add
PyModule_Add()function.2023-07-12: Add functions:
PyObject_GetOptionalAttr()PyObject_GetOptionalAttrString()PyMapping_GetOptionalItem()PyMapping_GetOptionalItemString()
2023-07-05: Add
PyObject_Vectorcall()function.2023-06-21: Add
PyWeakref_GetRef()function.2023-06-20: Add
PyImport_AddModuleRef()function.2022-11-15: Add experimental operations to the
upgrade_pythoncapi.pyscript:Py_NewRef,Py_CLEARandPy_SETREF.2022-11-09: Fix
Py_SETREF()andPy_XSETREF()macros for gh-98724.2022-11-04: Add
PyFrame_GetVar()andPyFrame_GetVarString()functions.2022-08-04: Add
PyCode_GetVarnames(),PyCode_GetFreevars()andPyCode_GetCellvars()functions.2022-06-14: Fix compatibility with C++ older than C++11.
2022-05-03: Add
PyCode_GetCode()function.2022-04-26: Rename the project from
pythoncapi_compattopythoncapi-compat: replace the underscore separator with a dash.2022-04-08: Add functions
PyFrame_GetLocals(),PyFrame_GetGlobals()PyFrame_GetBuiltins(), andPyFrame_GetLasti().2022-03-12: Add functions
PyFloat_Pack2(),PyFloat_Pack4(),PyFloat_Pack8(),PyFloat_Unpack2(),PyFloat_Unpack4()andPyFloat_Unpack8().2022-03-03: The project moved to https://github.com/python/pythoncapi-compat
2022-02-11: The project license changes from the MIT license to the Zero Clause BSD (0BSD) license. Projects copying
pythoncapi_compat.hno longer have to include the MIT license and the copyright notice.2022-02-08: Add documentation.
2022-02-09:
pythoncapi_compat.hnow supports C++ on Python 3.6 and newer: usenullptrandreinterpret_cast<type>cast on C++, and useNULLand(type)cast on C.2021-10-15: Add
PyThreadState_EnterTracing()andPyThreadState_LeaveTracing().2021-04-09: Add
Py_Is(),Py_IsNone(),Py_IsTrue(),Py_IsFalse()functions.2021-04-01:
Add
Py_SETREF(),Py_XSETREF()andPy_UNUSED().Add PyPy support.
2021-01-27: Fix compatibility with Visual Studio 2008 for Python 2.7.
2020-11-30: Creation of the
upgrade_pythoncapi.pyscript.2020-06-04: Creation of the
pythoncapi_compat.hheader file.