mirror of https://github.com/python/cpython
22b0de2755
This PR sets up tagged pointers for CPython. The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly. Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out. This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it. The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs. Please read Include/internal/pycore_stackref.h for more information! --------- Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com> |
||
---|---|---|
.. | ||
cpython | ||
internal | ||
Python.h | ||
README.rst | ||
abstract.h | ||
bltinmodule.h | ||
boolobject.h | ||
bytearrayobject.h | ||
bytesobject.h | ||
ceval.h | ||
codecs.h | ||
compile.h | ||
complexobject.h | ||
critical_section.h | ||
datetime.h | ||
descrobject.h | ||
dictobject.h | ||
dynamic_annotations.h | ||
enumobject.h | ||
errcode.h | ||
exports.h | ||
fileobject.h | ||
fileutils.h | ||
floatobject.h | ||
frameobject.h | ||
genericaliasobject.h | ||
import.h | ||
intrcheck.h | ||
iterobject.h | ||
listobject.h | ||
lock.h | ||
longobject.h | ||
marshal.h | ||
memoryobject.h | ||
methodobject.h | ||
modsupport.h | ||
moduleobject.h | ||
monitoring.h | ||
object.h | ||
objimpl.h | ||
opcode.h | ||
opcode_ids.h | ||
osdefs.h | ||
osmodule.h | ||
patchlevel.h | ||
py_curses.h | ||
pyatomic.h | ||
pybuffer.h | ||
pycapsule.h | ||
pydtrace.d | ||
pydtrace.h | ||
pyerrors.h | ||
pyexpat.h | ||
pyframe.h | ||
pyhash.h | ||
pylifecycle.h | ||
pymacconfig.h | ||
pymacro.h | ||
pymath.h | ||
pymem.h | ||
pyport.h | ||
pystate.h | ||
pystats.h | ||
pystrcmp.h | ||
pystrtod.h | ||
pythonrun.h | ||
pythread.h | ||
pytypedefs.h | ||
rangeobject.h | ||
refcount.h | ||
setobject.h | ||
sliceobject.h | ||
structmember.h | ||
structseq.h | ||
sysmodule.h | ||
traceback.h | ||
tupleobject.h | ||
typeslots.h | ||
unicodeobject.h | ||
warnings.h | ||
weakrefobject.h |
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/