8000 update code order · python/cpython@d08c18f · GitHub
[go: up one dir, main page]

Skip to content

Commit d08c18f

Browse files
committed
update code order
1 parent ba98fc1 commit d08c18f

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Python/pystate.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ PyInterpreterState_Clear(PyInterpreterState *interp)
286286
}
287287
HEAD_UNLOCK(runtime);
288288

289-
PyObject *sysdict = interp->sysdict;
290-
PyObject *builtins = interp->builtins;
291-
292289
Py_CLEAR(interp->audit_hooks);
293290

294291
PyConfig_Clear(&interp->config);
@@ -297,6 +294,8 @@ PyInterpreterState_Clear(PyInterpreterState *interp)
297294
Py_CLEAR(interp->codec_error_registry);
298295
Py_CLEAR(interp->modules);
299296
Py_CLEAR(interp->modules_by_index);
297+
PyDict_Clear(interp->sysdict);
298+
PyDict_Clear(interp->builtins);
300299
Py_CLEAR(interp->sysdict);
301300
Py_CLEAR(interp->builtins);
302301
Py_CLEAR(interp->builtins_copy);
@@ -311,13 +310,6 @@ PyInterpreterState_Clear(PyInterpreterState *interp)
311310
if (_PyRuntimeState_GetFinalizing(runtime) == NULL) {
312311
_PyWarnings_Fini(interp);
313312
}
314-
315-
/* We don't clear sysdict and builtins until the end of this function.
316-
Because clearing 5F2D other attributes can execute arbitrary Python code
317-
which requires sysdict and builtins. */
318-
PyDict_Clear(sysdict);
319-
PyDict_Clear(builtins);
320-
321313
// XXX Once we have one allocator per interpreter (i.e.
322314
// per-interpreter GC) we must ensure that all of the interpreter's
323315
// objects have been cleaned up at the point.

0 commit comments

Comments
 (0)
0