]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-112529: Remove PyGC_Head from object pre-header in free-threaded build (#114564)
authorSam Gross <colesbury@gmail.com>
Thu, 1 Feb 2024 20:29:19 +0000 (15:29 -0500)
committerGitHub <noreply@github.com>
Thu, 1 Feb 2024 20:29:19 +0000 (12:29 -0800)
commit587d4802034749e2aace9c00b00bd73eccdae1e7
treeba760dcffd508c28bb8ed42930bd7fba009dd38a
parent500ede01178a8063bb2a3c664172dffa1b40d7c9
gh-112529: Remove PyGC_Head from object pre-header in free-threaded build (#114564)

* gh-112529: Remove PyGC_Head from object pre-header in free-threaded build

This avoids allocating space for PyGC_Head in the free-threaded build.
The GC implementation for free-threaded CPython does not use the
PyGC_Head structure.

 * The trashcan mechanism uses the `ob_tid` field instead of `_gc_prev`
   in the free-threaded build.
 * The GDB libpython.py file now determines the offset of the managed
   dict field based on whether the running process is a free-threaded
   build. Those are identified by the `ob_ref_local` field in PyObject.
 * Fixes `_PySys_GetSizeOf()` which incorrectly incorrectly included the
   size of `PyGC_Head` in the size of static `PyTypeObject`.
Include/internal/pycore_object.h
Include/object.h
Lib/test/test_sys.py
Misc/NEWS.d/next/Core and Builtins/2024-01-25-18-50-49.gh-issue-112529.IbbApA.rst [new file with mode: 0644]
Modules/_testinternalcapi.c
Objects/object.c
Python/gc_free_threading.c
Python/sysmodule.c
Tools/gdb/libpython.py