Skip to content

Commit 203c112

Browse files
Drop _Py_NormalizeImmortalReference().
1 parent b2bf609 commit 203c112

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

Objects/object.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,38 +2541,6 @@ _Py_ResurrectReference(PyObject *op)
25412541

25422542

25432543
#ifdef Py_TRACE_REFS
2544-
/* Make sure the ref is associated with the right interpreter.
2545-
* This only needs special attention for heap-allocated objects
2546-
* that have been immortalized, and only when the object might
2547-
* outlive the interpreter where it was created. That means the
2548-
* object was necessarily created using a global allocator
2549-
* (i.e. from the main interpreter). Thus in that specific case
2550-
* we move the object over to the main interpreter's refchain.
2551-
*
2552-
* This was added for the sake of the immortal interned strings,
2553-
* where legacy subinterpreters share the main interpreter's
2554-
* interned dict (and allocator), and therefore the strings can
2555-
* outlive the subinterpreter.
2556-
*
2557-
* It may make sense to fold this into _Py_SetImmortalUntracked(),
2558-
* but that requires further investigation. In the meantime, it is
2559-
* up to the caller to know if this is needed. There should be
2560-
* very few cases.
2561-
*/
2562-
void
2563-
_Py_NormalizeImmortalReference(PyObject *op)
2564-
{
2565-
assert(_Py_IsImmortal(op));
2566-
PyInterpreterState *interp = _PyInterpreterState_GET();
2567-
if (!_PyRefchain_IsTraced(interp, op)) {
2568-
return;
2569-
}
2570-
if (!has_own_refchain(interp)) {
2571-
interp = _PyInterpreterState_Main();
2572-
}
2573-
assert(_PyRefchain_IsTraced(interp, op));
2574-
}
2575-
25762544
void
25772545
_Py_ForgetReference(PyObject *op)
25782546
{

Objects/unicodeobject.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15444,10 +15444,6 @@ _PyUnicode_InternStatic(PyInterpreterState *interp, PyObject **p)
1544415444
assert(*p);
1544515445
}
1544615446

15447-
#ifdef Py_TRACE_REFS
15448-
extern void _Py_NormalizeImmortalReference(PyObject *);
15449-
#endif
15450-
1545115447
static void
1545215448
immortalize_interned(PyObject *s)
1545315449
{
@@ -15463,10 +15459,6 @@ immortalize_interned(PyObject *s)
1546315459
#endif
1546415460
_PyUnicode_STATE(s).interned = SSTATE_INTERNED_IMMORTAL;
1546515461
_Py_SetImmortal(s);
15466-
#ifdef Py_TRACE_REFS
15467-
/* Make sure the ref is associated with the right interpreter. */
15468-
_Py_NormalizeImmortalReference(s);
15469-
#endif
1547015462
}
1547115463

1547215464
static /* non-null */ PyObject*

0 commit comments

Comments
 (0)