Skip to content

Commit 59e7727

Browse files
committed
Delay destruction of trampoline code object and make symbol private
1 parent 7f5348a commit 59e7727

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Python/ceval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10371037
py_frame.f_locals = NULL;
10381038
py_frame.frame_obj = NULL;
10391039
py_frame.f_code = tstate->interp->interpreter_trampoline;
1040+
assert(tstate->interp->interpreter_trampoline != NULL);
10401041
py_frame.prev_instr = _PyCode_CODE(tstate->interp->interpreter_trampoline);
10411042
py_frame.stacktop = 0;
10421043
py_frame.owner = FRAME_OWNED_BY_CSTACK;

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ pycore_init_types(PyInterpreterState *interp)
757757
return _PyStatus_OK();
758758
}
759759

760-
const char INTERPRETER_TRAMPOLINE_CODE[] = {
760+
static const char INTERPRETER_TRAMPOLINE_CODE[] = {
761761
0, 0,
762762
INTERPRETER_EXIT, 0,
763763
RESUME, 0

Python/pystate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
425425
Py_CLEAR(interp->importlib);
426426
Py_CLEAR(interp->import_func);
427427
Py_CLEAR(interp->dict);
428-
Py_CLEAR(interp->interpreter_trampoline);
429428
#ifdef HAVE_FORK
430429
Py_CLEAR(interp->before_forkers);
431430
Py_CLEAR(interp->after_forkers_parent);
@@ -451,6 +450,7 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
451450
PyDict_Clear(interp->builtins);
452451
Py_CLEAR(interp->sysdict);
453452
Py_CLEAR(interp->builtins);
453+
Py_CLEAR(interp->interpreter_trampoline);
454454

455455
// XXX Once we have one allocator per interpreter (i.e.
456456
// per-interpreter GC) we must ensure that all of the interpreter's

0 commit comments

Comments
 (0)