201 Commits
Author SHA1 Message Date
Victor StinnerandPetr Viktorin 20cb7fc707 gh-158886: Add INCREF/DECREF macros to stable_abi.toml (GH-158941)
* Add 7 INCREF/DECREF macros
* distinguish between 'const' and 'macro' in stable_abi.dat
  The file now has the 'kind' from the toml, not the ReST role.
* Fix kind of PY_VECTORCALL_ARGUMENTS_OFFSET
* Make it explicit that macros aren't part of the ABI
* Add is_static_inline_function to the TOML file (these are treated as macros in the docs)


Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-10-08 14:12:57 +02:00
Victor Stinner ec14f81e74 gh-158842: Add Py_SETREF() and Py_XSETREF() to the limited C API (#158843)
Test these macros with the limited C API in _testlimitedcapi and
test_cext.

Move also other tests (refcount, Py_CLEAR, etc.) to _testlimitedcapi.
2026-10-06 21:13:49 +02:00
Victor Stinner 7242fea93c gh-158001: Remove global configuration variables from C API (#158020)
Keep 4 variables in the stable ABI:

* Py_FileSystemDefaultEncodeErrors
* Py_FileSystemDefaultEncoding
* Py_HasFileSystemDefaultEncoding
* Py_UTF8Mode

Mark the 4 variables as ABI only in Misc/stable_abi.toml.
2026-09-24 16:42:02 +02:00
Victor Stinner a5a4659548 gh-158001: Remove Py_SetProgramName() function (#158024)
Remove Py_SetProgramName(), Py_SetPythonHome(), PySys_SetArgv() and
PySys_SetArgvEx() functions, deprecated since Python 3.11.

Mark the 4 functions as abi_only in stable_abi.toml.
2026-09-24 12:52:54 +02:00
Victor Stinner 82936545cc gh-154757: Remove deprecated PyEval_InitThreads() function (#158037)
Remove it from the C API, but keep it in the stable ABI.
2026-09-24 10:47:59 +02:00
Victor Stinner 7cfb6552ff gh-148233: Add Py_HashBuffer() to the limited C API (#157966) 2026-09-23 11:17:39 +02:00
da-woods 58beae7319 Correct Stable ABI documentation for METH_FASTCALL (GH-149593)
* Correct Stable ABI documentation for METH_FASTCALL

The current documentation says:

> 
> METH_FASTCALL
>    Part of the Stable ABI since version 3.7.
>
> [...]
>
>   Added in version 3.7.
>
>    Changed in version 3.10: METH_FASTCALL is now part of the stable ABI.

so is contradictory about when it was added to the Stable ABI.  Looking at the header it seems like 3.10 is right.
2026-06-03 15:20:35 +02:00
Jelle Zijlstra 08218030a5 gh-148829: Make sentinels' repr and module customizable (#149654)
Implementation of python/peps#4968; still needs SC approval.
2026-05-19 09:18:56 -07:00
2b7c28a440 gh-149101: Implement PEP 788 (GH-149116)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-05-06 17:39:30 -04:00
Petr ViktorinandPeter Bierma 508b49845d gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-05-05 09:18:04 +02:00
Petr Viktorin 6ca5cdba18 gh-149225: Expose Py_CriticalSection in Stable ABI (GH-149227) 2026-05-04 17:32:17 +02:00
Victor StinnerandPetr Viktorin ce51c18818 gh-146063: Add PyObject_CallFinalizerFromDealloc() to the limited C API (#146172)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-04 15:37:45 +02:00
29a92abb60 gh-148829: Implement PEP 661 (#148831)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-27 19:28:30 -07:00
Petr ViktorinandHugo van Kemenade 0fcf2b72d3 gh-146636: PEP 803: Reference documentation (GH-148013)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-16 14:17:44 +02:00
Kumar AdityaandVictor Stinner dd88e77fad gh-142518: add thread safety docs for set C-APIs (#146562)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-10 19:33:24 +00:00
Lysandros Nikolaou 15d10a8243 gh-142518: annotate dict C-APIs for thread safety (#145875) 2026-04-10 18:41:12 +00:00
8923ca418c gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925)
There are newly documented restrictions on tp_traverse:

    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.

* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-08 09:15:11 +02:00
Kumar Aditya 03d712e9ba gh-142518: add thread safety annotations for tuple C-API (#148012) 2026-04-08 01:55:44 +05:30
Pieter Eendebak 67354b2925 gh-145563: Add thread-safety annotation for PyCapsule C-API (#146612) 2026-03-31 16:32:35 +05:30
Kumar Aditya 5466f57ead gh-142518: add thread safety annotations for bytearray C-API (#146514) 2026-03-27 18:40:26 +05:30
Kumar Aditya 6a94980301 gh-142518: add thread safety docs on bytes C-API (#146415) 2026-03-27 18:31:18 +05:30
Lysandros Nikolaou 5b25eaec37 gh-142518: Annotate PyList_* C APIs for thread safety (#146109) 2026-03-18 17:42:20 +01:00
Lysandros Nikolaou 0dce4c6eab gh-145254: Add thread safety annotation in docs (#145255) 2026-03-12 12:18:43 +05:30
Petr Viktorin 44855458a4 Document that PyType_GetModule returns a borrowed ref (GH-145612) 2026-03-09 14:32:28 +01:00
Sergey B KirpichevandPetr Viktorin 4c7ec78092 gh-143869: Add PEP 757 functions to the limited API (#143906)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-01-21 14:47:14 +01:00
Petr Viktorin c359ea4c71 gh-141909: Correct version where Py_mod_gil was added (GH-141979) 2025-11-26 14:45:06 +00:00
Petr Viktorin d7f0214f13 gh-140550: PEP 793 reference documentation (GH-141197)
* gh-140550: PEP 793 reference documentation

Since the PEP calls for soft-deprecation of the existing initialization
function, this reorganizes the relevant docs to put the new way of
doing things first, and de-emphasize the old.

Some bits, like the tutorial, are left out of this patch. (See the
issue for a list.)
2025-11-26 12:50:03 +00:00
Petr Viktorin 202fce0dbd gh-141909: Add PyModuleDef_Slot and earlier Py_mod_* constants to stable ABI manifest (#141910)
These were added to the limited API in 3.5.
Not including them in `Misc/stable_abi.toml` was a bug.
2025-11-25 15:16:49 +01:00
Petr Viktorin 226011ba12 gh-139165: Make Py_SIZE, Py_IS_TYPE,Py_ SET_SIZE regular functions in stable ABI (GH-139166)
* Make Py_{SIZE,IS_TYPE,SET_SIZE} regular functions in stable ABI

Group them together with Py_TYPE & Py_SET_TYPE to cut down
on repetitive preprocessor macros.
Format repetitive definitions in object.c more concisely.

Py_SET_TYPE is still left out of the Limited API.
2025-11-25 14:30:33 +01:00
da-woodsandStan Ulbrych afa0badcc5 gh-141726: Add PyDict_SetDefaultRef() to the Stable ABI (#141727)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-19 11:38:10 +00:00
Victor Stinner 579b2f8910 gh-140550: Run make regen-limited-abi (#141056) 2025-11-05 16:57:06 +00:00
589a03a8ce gh-140550: Initial implementation of PEP 793 – PyModExport (GH-140556)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-05 12:31:42 +01:00
Petr ViktorinandPeter Bierma d81e1ef0f3 gh-138189: Document type slots, and other constants, as part of Limited API (GH-138190)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-04 22:58:53 +01:00
Petr Viktorin 80cdf3ef74 Document that PyInterpreterState_GetDict returns a borrowed reference (#139451) 2025-10-01 09:46:06 +05:30
Bénédikt Tran a5e0562350 gh-133644: remove PyWeakref_GetObject and PyWeakref_GET_OBJECT (GH-133657) 2025-09-24 11:25:56 +02:00
sobolevn baf7470515 gh-138886: Remove deprecated PySys_ResetWarnOptions C-API function (#138887) 2025-09-15 12:01:33 +03:00
Petr ViktorinandSteve Dower 0c74fc8af0 gh-137210: Add a struct, slot & function for checking an extension's ABI (GH-137212)
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2025-09-05 16:23:18 +02:00
ca87a47b3d gh-135755: Docs: C API: Document missing PyFunction_GET* macros (GH-135762)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-25 08:44:55 +00:00
Petr Viktorin 140731ff67 Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666) 2025-06-19 09:00:41 +02:00
f4bc3a9320 gh-134160: Split extension module init from PyModule docs; emphasize multi-phase init (GH-135126)
Document behaviour of single-phase init. Call it "legacy".

Reorganize PyModule docs.

Move PyInit_modulename docs from the tutorial to reference documentation.

Move PyMODINIT_FUNC docs from generic macros to the new page.

Add doc stubs for `PYTHON_API_VERSION` & `PYTHON_ABI_VERSION`

Remove incorrect refcounts.dat entry for `PyModuleDef_Init`.
This removes the "Return value: Borrowed reference." note.
Instead, note that the function sometimes returns a borrowed reference,
sometimes as strong one.
(IMO, it's best to not think of `PyModuleDef` as a `PyObject` at all,
and act like it can't be reference-counted.)


Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-13 16:39:35 +02:00
Serhiy Storchaka bac3fcba5b gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)
Add functions PySys_GetAttr(), PySys_GetAttrString(),
PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
2025-05-28 20:11:09 +03:00
Stan Ulbrych 4fd1095280 gh-133610: Remove PyUnicode_AsDecoded/Encoded functions (#133612) 2025-05-09 17:31:24 +02:00
Stan Ulbrych f34ec09ba5 gh-46236: Document PyUnicode_BuildEncodingMap (#133270) 2025-05-09 17:19:07 +02:00
Bénédikt Tran 5044e85265 gh-133644: Remove deprecated Python initialization getter functions (#133661)
Remove functions:

* Py_GetExecPrefix()
* Py_GetPath()
* Py_GetPrefix()
* Py_GetProgramFullPath()
* Py_GetProgramName()
* Py_GetPythonHome()
2025-05-09 11:39:23 +00:00
Bénédikt Tran a2c4467d06 gh-133644: remove deprecated PyImport_ImportModuleNoBlock (#133655) 2025-05-08 13:08:43 +00:00
RUANG (James Roy)andStan Ulbrych 05d0559db0 gh-46236: Add PyUnicode_Resize() doc (#132628)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-22 11:39:04 +02:00
Steve Dower 09b624b80f gh-132639: Adds PyLong_AsNativeBytes, PyLong_FromNativeBytes and PyLong_FromUnsignedNativeBytes to the limited API (GH-132640) 2025-04-21 15:59:03 +01:00
RUANG (James Roy) 8768df2fe9 gh-46236: Add missing PyUnicode_FromOrdinal() doc (#132040) 2025-04-14 18:40:39 +02:00
Victor Stinner 10cbd1fe88 gh-130947: Add again PySequence_Fast() to the limited C API (#130948)
Add again PySequence_Fast() to the limited C API.

Add unit tests.
2025-03-13 13:00:57 +01:00
RUANG (James Roy)andPetr Viktorin faadb446d9 gh-46236: Add missing PyUnicode_Append() doc (#130531)
* Add missing PyUnicode_Append() doc

* Change the copied content

* Add '`` ``'

* Change doc

* Add PyUnicode_AppendAndDel function doc

* Change doc

* Add PyUnicode_AppendAndDel to refcounts

* Change doc

* Change doc

Co-authored-by: Petr Viktorin <encukou@gmail.com>

* Change doc

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-11 10:28:17 +01:00