cpython/Include
Jeremy Maitin-Shepard 8cc5aa47ee
gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)
Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-10-02 09:17:49 -07:00
..
cpython gh-111178: Fix function signatures in longobject.c (#124895) 2024-10-02 17:41:19 +02:00
internal gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
Python.h gh-124609: Fix _Py_ThreadId for Windows builds using MinGW (#124663) 2024-09-27 18:52:23 +00:00
README.rst
abstract.h gh-105201: Add PyIter_NextItem() (#122331) 2024-08-08 00:47:15 +02:00
bltinmodule.h
boolobject.h gh-115754: Add Py_GetConstant() function (#116883) 2024-03-21 16:07:00 +00:00
bytearrayobject.h
bytesobject.h
ceval.h GH-120507: Lower the `BEFORE_WITH` and `BEFORE_ASYNC_WITH` instructions. (#120640) 2024-06-18 12:17:46 +01:00
codecs.h
compile.h
complexobject.h
critical_section.h gh-119344: Make critical section API public (#119353) 2024-06-21 15:50:18 -04:00
datetime.h
descrobject.h
dictobject.h
dynamic_annotations.h
enumobject.h
errcode.h gh-107450: Check for overflow in the tokenizer and fix overflow test (#110832) 2023-10-16 16:42:49 +02:00
exports.h gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
fileobject.h
fileutils.h
floatobject.h gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
frameobject.h
genericaliasobject.h
import.h
intrcheck.h
iterobject.h
listobject.h gh-114329: Fix PyList_GetItemRef() limited C API definition (#117520) 2024-04-03 21:02:42 +00:00
lock.h gh-117511: Make PyMutex public in the non-limited API (#117731) 2024-06-20 11:29:08 -04:00
longobject.h gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390) 2024-08-28 10:16:13 +00:00
marshal.h
memoryobject.h
methodobject.h gh-114626: Add again _PyCFunctionFastWithKeywords name (GH-115561) 2024-02-19 13:20:46 +01:00
modsupport.h gh-112136: Restore removed _PyArg_Parser (#121262) 2024-07-03 18:36:57 +02:00
moduleobject.h gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
monitoring.h gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
object.h gh-124609: Fix _Py_ThreadId for Windows builds using MinGW (#124663) 2024-09-27 18:52:23 +00:00
objimpl.h gh-102013: Move PyUnstable_GC_VisitObjects() to Include/cpython/objimpl.h (#115560) 2024-02-16 15:49:13 +01:00
opcode.h
opcode_ids.h gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression (#124394) 2024-09-25 15:51:25 +01:00
osdefs.h
osmodule.h
patchlevel.h Python 3.14.0a0 2024-05-08 16:57:05 +02:00
py_curses.h gh-123961: Add a global state to _curses (#124729) 2024-09-29 15:17:20 +00:00
pyatomic.h
pybuffer.h
pycapsule.h
pydtrace.d
pydtrace.h
pyerrors.h gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680) 2024-06-24 14:08:12 +02:00
pyexpat.h gh-115398: Revert `PyExpat_CAPI_MAGIC` version bump (GH-116411) 2024-03-06 09:55:07 -08:00
pyframe.h
pyhash.h gh-111545: Add Include/cpython/pyhash.h header file (#112063) 2023-11-15 01:19:20 +01:00
pylifecycle.h gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993) 2024-04-18 15:20:38 +02:00
pymacconfig.h gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS (#112828) 2023-12-08 10:09:34 +01:00
pymacro.h gh-118124: fix assert related C++ checks on Solaris/Illumos (#121974) 2024-07-21 18:50:14 +02:00
pymath.h gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701) 2024-05-29 10:45:14 +00:00
pymem.h gh-85283: Add PyMem_RawMalloc() to the limited C API (#108570) 2023-10-17 02:41:51 +02:00
pyport.h gh-121040: Use __attribute__((fallthrough)) (#121044) 2024-06-27 09:58:44 +00:00
pystate.h gh-108867: Add PyThreadState_GetUnchecked() function (#108870) 2023-10-03 16:53:51 +00:00
pystats.h GH-124284: Add stats for refcount operations on immortal objects (GH-124288) 2024-09-23 19:10:55 +01:00
pystrcmp.h
pystrtod.h
pythonrun.h
pythread.h gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) 2024-10-02 09:17:49 -07:00
pytypedefs.h
rangeobject.h
refcount.h gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128) 2024-09-24 08:42:58 +02:00
setobject.h
sliceobject.h gh-115754: Add Py_GetConstant() function (#116883) 2024-03-21 16:07:00 +00:00
structmember.h Fix typos in comments (#120188) 2024-06-07 10:19:41 +02:00
structseq.h
sysmodule.h gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993) 2024-04-18 15:20:38 +02:00
traceback.h
tupleobject.h
typeslots.h gh-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot (GH-124163) 2024-09-18 09:18:19 +02:00
unicodeobject.h gh-111089: Revert PyUnicode_AsUTF8() changes (#111833) 2023-11-07 22:36:13 +00:00
warnings.h
weakrefobject.h gh-105927: Limit PyWeakref_GetRef() to limited C API 3.13 (#117091) 2024-03-20 23:52:23 +01:00

README.rst

The Python C API
================

The C API is divided into these sections:

1. ``Include/``: Limited API
2. ``Include/cpython/``: CPython implementation details
3. ``Include/cpython/``, names with the ``PyUnstable_`` prefix: API that can
   change between minor releases
4. ``Include/internal/``, and any name with ``_`` prefix: The internal API

Information on changing the C API is available `in the developer guide`_

.. _in the developer guide: https://devguide.python.org/c-api/