Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit623fb87

Browse files
Move non-isolated immortal objects to the right ref chain.
1 parent884f398 commit623fb87

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

‎Objects/object.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,24 @@ _Py_ResurrectReference(PyObject *op)
24912491

24922492

24932493
#ifdefPy_TRACE_REFS
2494+
void
2495+
_Py_NormalizeImmortalReference(PyObject*op)
2496+
{
2497+
assert(_Py_IsImmortal(op));
2498+
PyInterpreterState*interp=_PyInterpreterState_GET();
2499+
if (!_PyRefchain_IsTraced(interp,op)) {
2500+
return;
2501+
}
2502+
PyInterpreterState*main_interp=_PyInterpreterState_Main();
2503+
if (interp!=main_interp
2504+
&&interp->feature_flags&Py_RTFLAGS_USE_MAIN_OBMALLOC)
2505+
{
2506+
assert(!_PyRefchain_IsTraced(main_interp,op));
2507+
_PyRefchain_Remove(interp,op);
2508+
_PyRefchain_Trace(main_interp,op);
2509+
}
2510+
}
2511+
24942512
void
24952513
_Py_ForgetReference(PyObject*op)
24962514
{

‎Objects/unicodeobject.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15437,6 +15437,10 @@ _PyUnicode_InternStatic(PyInterpreterState *interp, PyObject **p)
1543715437
assert(*p);
1543815438
}
1543915439

15440+
#ifdefPy_TRACE_REFS
15441+
externvoid_Py_NormalizeImmortalReference(PyObject*);
15442+
#endif
15443+
1544015444
staticvoid
1544115445
immortalize_interned(PyObject*s)
1544215446
{
@@ -15452,6 +15456,9 @@ immortalize_interned(PyObject *s)
1545215456
#endif
1545315457
_PyUnicode_STATE(s).interned=SSTATE_INTERNED_IMMORTAL;
1545415458
_Py_SetImmortal(s);
15459+
#ifdefPy_TRACE_REFS
15460+
_Py_NormalizeImmortalReference(s);
15461+
#endif
1545515462
}
1545615463

1545715464
static/* non-null */PyObject*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp