[3.14] gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-1… · python/cpython@8dcf3ed · GitHub
Skip to content

Commit 8dcf3ed

Browse files
[3.14] gh-127705: Move Py_INCREF_MORTAL() to the internal C API (GH-136178) (#136206)
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. (cherry picked from commit fa43a1e) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 5216a6c commit 8dcf3ed

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

Include/internal/pycore_object.h

Lines changed: 14 additions & 0 deletions

Include/internal/pycore_stackref.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ _PyStackRef_FromPyObjectNew(PyObject *obj)
561561
if (_Py_IsImmortal(obj)) {
562562
return (_PyStackRef){ .bits = ((uintptr_t)obj) | Py_TAG_REFCNT};
563563
}
564-
Py_INCREF_MORTAL(obj);
564+
_Py_INCREF_MORTAL(obj);
565565
_PyStackRef ref = (_PyStackRef){ .bits = (uintptr_t)obj };
566566
PyStackRef_CheckValid(ref);
567567
return ref;
@@ -572,7 +572,7 @@ static inline _PyStackRef
572572
_PyStackRef_FromPyObjectNewMortal(PyObject *obj)
573573
{
574574
assert(obj != NULL);
575-
Py_INCREF_MORTAL(obj);
575+
_Py_INCREF_MORTAL(obj);
576576
_PyStackRef ref = (_PyStackRef){ .bits = (uintptr_t)obj };
577577
PyStackRef_CheckValid(ref);
578578
return ref;
@@ -590,14 +590,14 @@ PyStackRef_FromPyObjectImmortal(PyObject *obj)
590590
/* WARNING: This macro evaluates its argument more than once */
591591
#ifdef _WIN32
592592
#define PyStackRef_DUP(REF) \
593-
(PyStackRef_RefcountOnObject(REF) ? (Py_INCREF_MORTAL(BITS_TO_PTR(REF)), (REF)) : (REF))
593+
(PyStackRef_RefcountOnObject(REF) ? (_Py_INCREF_MORTAL(BITS_TO_PTR(REF)), (REF)) : (REF))
594594
#else
595595
static inline _PyStackRef
596596
PyStackRef_DUP(_PyStackRef ref)
597597
{
598598
assert(!PyStackRef_IsNull(ref));
599599
if (PyStackRef_RefcountOnObject(ref)) {
600-
Py_INCREF_MORTAL(BITS_TO_PTR(ref));
600+
_Py_INCREF_MORTAL(BITS_TO_PTR(ref));
601601
}
602602
return ref;
603603
}

Include/refcount.h

Lines changed: 0 additions & 14 deletions

0 commit comments

Comments
 (0)