Skip to content

Commit eb46d67

Browse files
committed
Avoid function calls to access the current thread state and builtins
-- the thread state is passed in as an argument and the builtins are a member thereof.
1 parent 8cf0476 commit eb46d67

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Objects/frameobject.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,11 @@ PyFrame_New(tstate, code, globals, locals)
222222
f->f_locals = locals;
223223
f->f_trace = NULL;
224224
f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL;
225-
f->f_tstate = PyThreadState_Get();
226-
if (f->f_tstate == NULL)
227-
Py_FatalError("can't create new frame without thread");
225+
f->f_tstate = tstate;
228226

229227
f->f_lasti = 0;
230228
f->f_lineno = code->co_firstlineno;
231-
f->f_restricted = (builtins != PyBuiltin_GetDict());
229+
f->f_restricted = (builtins != tstate->interp->builtins);
232230
f->f_iblock = 0;
233231
f->f_nlocals = code->co_nlocals;
234232
f->f_stacksize = extras - code->co_nlocals;

0 commit comments

Comments
 (0)