Resources

Glossary

Every term the course introduces, with the lesson that introduces it. Type to filter.

TermMeaningLesson
abi3The wheel and filename tag for a binary built against the Limited API, loadable by every CPython from a declared minimum version upward. Not available for free-threaded builds.L09
Abstract APIThe PyObject_*, PyNumber_*, PySequence_*, PyMapping_* layer, which dispatches through the object's type and can therefore execute arbitrary Python code.L01
Argument ClinicCPython's preprocessor that turns a declarative signature into a fast keyword parser, a docstring, and an introspectable signature.L06
Attached / detachedModern terminology for whether a thread's PyThreadState is installed and (on GIL builds) the GIL held. "Detached" replaces "released the GIL", because detaching still matters without a GIL.L10
Biased reference countingThe free-threaded build's scheme: a non-atomic local count owned by one thread plus an atomic shared count for the others. Makes Py_REFCNT no longer a single readable integer.L11
Borrowed referenceA pointer to an object that someone else is keeping alive. You must not decref it, and it is valid only as long as that owner keeps it.L02
Buffer protocolPEP 3118. Lets an object expose its flat memory block to C directly, with no copy, while pinning the address for the lifetime of the view.L12
Capsule (PyCapsule)A Python object wrapping a void * with a name and optional destructor. The name is a type check. Used to pass opaque pointers and to export a C API between extensions.L13
Code objectThe immutable compiled unit — bytecode, constants, names — created once per function definition and shared by every call.L07
Concrete APIType-specific functions such as PyLong_* and PyList_*. Faster than the abstract layer, but you must verify the type first.L01
Critical sectionPy_BEGIN_CRITICAL_SECTION / ..._SECTION2. Locks one or two Python objects' internal mutexes. The lock is suspended if the enclosed code blocks; at most two objects.L11
Cycle collectorThe generational tracing collector that reclaims unreachable reference cycles, which plain reference counting cannot. Finds them by subtracting internal references.L04
Deferred reference countingSkipping refcount updates for functions, code objects, modules and types on the interpreter stack. Their true count is only knowable during a collection pause.L11
defining_classThe class in which a method was defined, supplied by the METH_METHOD convention. The correct way for a heap-type method to reach module state, since Py_TYPE(self) may be a Python subclass.L08
DunderA "double underscore" special method name such as __add__. The Python-visible spelling of a C slot.L03
Error indicatorPer-thread state holding the exception currently in flight. Must be set exactly when a C function returns its error sentinel.L05
Eval loop_PyEval_EvalFrameDefault, the C function that executes bytecode. Its internals change every release; the public API is what stays stable.L07
EXT_SUFFIXThe platform- and version-specific filename suffix for an extension, e.g. .cp314-win_amd64.pyd. Encodes the compatibility contract.L09
Format unitOne character (or pair) in a PyArg_ParseTuple format string describing one argument's conversion. Units such as s, y, O yield borrowed pointers; s*, y*, w* yield a Py_buffer you must release.L06
FrameThe per-call runtime state: locals, value stack, instruction offset, link to the caller. Since 3.11 the PyFrameObject is materialized lazily. C functions get no frame.L07
Free-threaded buildThe GIL-less CPython build (python3.14t, Py_GIL_DISABLED). Officially supported since 3.14, not the default, and a distinct ABI.L11
GILGlobal interpreter lock: the per-interpreter mutex a thread must hold to execute bytecode or call almost any C API function.L10
Heap typeA type created at runtime from a PyType_Spec, owned by a module instance. Can reach module state, works under subinterpreters, required by the Limited API.L03
Immortal objectAn object whose refcount is pinned so incref/decref are no-ops: None, True, False, small ints, interned strings, static types (PEP 683).L01
Limited APIThe documented C API subset that avoids layout-dependent macros, enabled with #define Py_LIMITED_API. Its binary counterpart is the stable ABI.L09
m_sizePyModuleDef field giving the size of per-module state. 0 for none, positive for a state struct, -1 for legacy C globals.L08
m_traverse / m_clear / m_freeThe module-level equivalents of tp_traverse/tp_clear/deallocation. Required when module state holds PyObject *.L08
METH_ flagsCalling conventions in PyMethodDef: METH_NOARGS, METH_O, METH_VARARGS, METH_KEYWORDS, METH_FASTCALL, METH_METHOD, plus METH_CLASS/METH_STATIC/METH_COEXIST.L06
mimallocThe thread-safe allocator that replaces pymalloc in free-threaded builds, with segregated heaps that make mixing allocator families fatal.L11
Module stateA struct allocated per module instance, reachable with PyModule_GetState. Replaces C globals so that subinterpreters and reloads work.L08
MROMethod resolution order: the linearized base-class sequence computed by PyType_Ready, used to inherit unset slots.L03
Multi-phase initializationPEP 489. PyInit_x returns a module definition; the import machinery creates the module and calls your Py_mod_exec. Prerequisite for isolation.L08
New referenceSynonym for a strong reference returned to you by a function; you own one decref.L02
Py_bufferThe struct describing an exported memory block: pointer, exporter, length, itemsize, format, shape, strides. Must be released with PyBuffer_Release.L12
Py_BEGIN_ALLOW_THREADSMacro pair expanding to PyEval_SaveThread/PyEval_RestoreThread. Detaches the thread state around work that touches no Python object.L10
Py_CLEARSets a field to NULL before decrefing the old value, so code re-entered by the deallocator never sees a dangling pointer.L02
Py_EnterRecursiveCallOpt-in recursion guard for C code, which otherwise consumes no Python frames and can overflow the native stack instead of raising RecursionError.L07
Py_GIL_DISABLEDPreprocessor macro defined in free-threaded builds. On Windows from 3.14 the build backend must define it explicitly.L11
Py_mod_gilModule slot declaring whether the module needs the GIL. Py_MOD_GIL_NOT_USED is an unverified promise of thread safety; without it a free-threaded interpreter re-enables the GIL process-wide.L11
Py_ssize_tSigned integer the width of size_t, used for every length, index and count so that -1 can mean error (PEP 353).L01
Py_TPFLAGS_HAVE_GCType flag declaring participation in cycle collection. Requires tp_traverse.L04
Py_VISITMacro used inside tp_traverse: NULL-checks the field, calls visit, and returns early on a non-zero result.L04
PyErr_GetRaisedExceptionModern (3.12+) way to take the in-flight exception out and put it back with PyErr_SetRaisedException. Replaces PyErr_Fetch/Restore.L05
PyGILState_EnsureAttaches the current thread, creating a thread state if needed. The way a foreign thread enters Python. Unsafe during finalization.L10
PyInit_<name>The single symbol the import machinery looks up in a loaded shared library. Must match the last component of the module name.L08
PyInterpreterStatePer-interpreter state: module table, builtins, import machinery, the GIL. More than one exists when subinterpreters are in use.L10
PyMethodDefThe struct that exposes a C function to Python: name, function pointer, calling convention, docstring.L06
PyModuleDefThe static description of a module: name, docstring, state size, methods, slots, and GC hooks.L08
PyMutexOne-byte lock added in 3.13 that detaches the thread state while waiting, which removes the classic GIL/lock deadlock. Zero-initialize; never copy.L10
PyObjectThe universal object header: a reference count and a type pointer. Every Python value begins with one.L01
PyObject_HEADMacro placing a PyObject as the first member of your instance struct, making the pointer cast to PyObject * valid.L01
PyThreadStatePer-thread interpreter state: current frame, exception state, recursion depth, tracing hooks.L10
PyTypeObjectThe C struct behind a Python class: mostly function pointers (slots), plus size and flag fields.L03
PyType_Spec / PyType_SlotThe data-driven description of a heap type, passed to PyType_FromModuleAndSpec. The only way to define a type under the Limited API.L03
PyVarObjectHeader for variable-length objects, adding ob_size. Used by tuples, strings and ints.L01
ReentrancyThe property that any call which can run Python code can re-enter your own code. Forces you to leave data structures consistent before every such call.L02
Reference countob_refcnt: how many places currently hold a valid pointer to the object. At zero, the deallocator runs.L02
SentinelThe error return value: NULL for PyObject *, -1 for int and Py_ssize_t. Ambiguous for conversions where -1 is a valid result.L05
SlotA function-pointer field in PyTypeObject implementing one behaviour, such as tp_repr or nb_add. The real mechanism behind dunder methods.L03
Stable ABIThe binary contract corresponding to the Limited API: symbols guaranteed compatible across CPython 3.x releases. Tagged abi3.L09
Static typeA PyTypeObject declared in static storage and readied with PyType_Ready. One per process; cannot reach module state; not usable with the Limited API.L03
Stealing a referenceA function taking over ownership of a reference you pass in, so you must not decref afterwards. PyTuple_SetItem, PyList_SetItem, Py_BuildValue's N.L02
Strong referenceA reference whose count was incremented for you. The object is guaranteed alive; you owe exactly one decref.L02
SubinterpreterAn additional PyInterpreterState in the same process, optionally with its own GIL (PEP 684). Requires extensions with no PyObject * globals.L08
tp_alloc / tp_freeThe type's allocator and deallocator for instance memory. Always call through the instance's own type so subclasses work.L03
tp_clearDrops the instance's object references to break a cycle. Must be idempotent, must use Py_CLEAR, must not release foreign resources.L04
tp_deallocRuns when the refcount reaches zero. Order: untrack, clear fields, tp_free, then decref the type for heap types.L03
tp_finalizeThe slot behind __del__. Runs once, before deallocation, while the object is still valid. Where user-visible cleanup belongs.L04
tp_init / tp_newTwo-phase construction: tp_new allocates and returns an instance, tp_init applies arguments and may run again or never.L03
tp_iternextThe iterator slot. Returning NULL with no exception set means exhausted.L07
tp_traverseEnumerates the object references this instance owns, for the cycle collector. Must be pure: no allocation, no Python code, no raising.L04
Unraisable exceptionAn exception raised where there is no caller to receive it — inside a deallocator or a C callback. Report it with PyErr_FormatUnraisable, which routes to sys.unraisablehook.L05
VectorcallPEP 590. A calling protocol passing a pointer to a contiguous argument array plus a count, avoiding the tuple allocation of METH_VARARGS.L06
Wheel tagThe compatibility triple in a wheel filename, e.g. cp314-cp314t-manylinux_2_28_x86_64. The t marks a free-threaded build.L09