Commit Graph

23 Commits

Author SHA1 Message Date
Victor Stinner 728d239e57 gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 (#140158) 2025-10-15 16:36:49 +02:00
Petr Viktorin c7d24b81c3 gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API (GH-136505)
Allow Py_LIMITED_API for (Py_GIL_DISABLED && _Py_OPAQUE_PYOBJECT)


API that's removed when _Py_OPAQUE_PYOBJECT is defined:

    - PyObject_HEAD
    - _PyObject_EXTRA_INIT
    - PyObject_HEAD_INIT
    - PyObject_VAR_HEAD
    - struct _object (i.e. PyObject) (opaque)
    - struct PyVarObject (opaque)
    - Py_SIZE
    - Py_SET_TYPE
    - Py_SET_SIZE
    - PyModuleDef_Base (opaque)
    - PyModuleDef_HEAD_INIT
    - PyModuleDef (opaque)
    - _Py_IsImmortal
    - _Py_IsStaticImmortal

Note that the `_Py_IsImmortal` removal (and a few other issues)
 means _Py_OPAQUE_PYOBJECT only works with limited
API 3.14+ now.


Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-12 09:55:12 +02:00
Victor Stinner fa43a1e0f8 gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-136178)
Rename Py_INCREF_MORTAL() to _Py_INCREF_MORTAL() and move it to
pycore_object.h internal header.
2025-07-02 15:40:41 +02:00
Weilin Du 698bab5a40 Doc: fix duplicated words (#136086)
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-06-29 18:04:02 -04:00
Petr Viktorin 6be17baeb5 gh-135755: Use private names (_Py*) for header file guards new in 3.14 (GH-135921)
These are private API; let's name new ones accordingly.
2025-06-26 13:05:01 +02:00
Neil Schemenauer fbbbc10055 gh-127266: avoid data races when updating type slots (gh-133177)
In the free-threaded build, avoid data races caused by updating type
slots or type flags after the type was initially created.  For those
(typically rare) cases, use the stop-the-world mechanism.  Remove the
use of atomics when reading or writing type flags.
2025-05-27 18:27:41 -07:00
Neil Schemenauer eecafc3380 Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)
This is triggering deadlocks in test_opcache.  See GH-133130 for stack trace.
2025-04-28 23:38:29 -07:00
Neil Schemenauer e414a2d81c gh-127266: avoid data races when updating type slots (gh-131174)
In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created.  For those (typically
rare) cases, use the stop-the-world mechanism.  Remove the use of atomics
when reading or writing type flags.  The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.
2025-04-28 20:28:44 +00:00
Mark Shannon fd545d735d GH-127705: Move mortal decrefs to internal header and make sure _PyReftracerTrack is called 2025-03-17 17:23:50 +00:00
Mark Shannon 9881fc5483 GH-125174: Make immortality "sticky" (GH-131355)
* Use a higher threshold for immortality for INCREF than DECREF
2025-03-17 17:22:35 +00:00
Mark Shannon 67af96c61c GH-127705: Handle trace refs in specialized decref (GH-131198)
This is missing `_PyReftracerTrack` calls, see gh-131238.
Merging as-is for the 3.14.0a6 release.
2025-03-14 13:02:09 +01:00
Mark Shannon 2250ab6a13 GH-125174 Revert: Make immortality "sticky" (GH-131184)" (#131230)
Revert "GH-125174: Make immortality "sticky" (GH-131184)"

This reverts commit 3a91ee9724.
2025-03-14 13:13:47 +02:00
Mark Shannon 3a91ee9724 GH-125174: Make immortality "sticky" (GH-131184) 2025-03-13 16:10:13 +00:00
Mark Shannon f30376c650 GH-127705: Fix _Py_RefcntAdd to handle objects becoming immortal (GH-131140) 2025-03-12 16:54:10 +00:00
Mark Shannon 6e5b9f3d00 GH-127705: Check for immortality in refcount accounting (#131072)
Check for immortality in refcount accounting
2025-03-11 11:53:07 +00:00
Mark Shannon 2bef8ea8ea GH-127705: Use _PyStackRefs in the default build. (GH-127875) 2025-03-10 14:06:56 +00:00
Justine Krejcha 31ef8fd8e2 Fix a typo in Py_DECREF comment (#128387) 2025-02-25 11:10:40 +01:00
Mark Shannon 9b4bbf4401 GH-125174: Don't use UINT32_MAX in header file (GH-127863) 2024-12-13 10:54:59 +01:00
Mark Shannon bc262de06b GH-125174: Mark objects as statically allocated. (#127797)
* Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build.

* Use the top of the refcount range on 32 bit machines
2024-12-11 17:37:38 +00:00
Mark Shannon c9014374c5 GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251) 2024-10-10 18:19:08 +01:00
Victor Stinner 9d344fafc4 gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128) 2024-09-24 08:42:58 +02:00
Mark Shannon c87b0e4a46 GH-124284: Add stats for refcount operations on immortal objects (GH-124288) 2024-09-23 19:10:55 +01:00
Victor Stinner 891c1e36f4 gh-119853: Add Include/refcount.h file (#119854) 2024-05-31 16:49:26 +02:00