Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69734a5

Browse files
author
Michael W. Hudson
committed
Check in my ultra-shortlived patch #597220.
Move some debugging checks inside Py_DEBUG. They were causing cache misses according to cachegrind.
1 parent c66ff44 commit 69734a5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Objects/frameobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
238238
if (builtin_object == NULL)
239239
return NULL;
240240
}
241-
if ((back != NULL && !PyFrame_Check(back)) ||
242-
code == NULL || !PyCode_Check(code) ||
243-
globals == NULL || !PyDict_Check(globals) ||
241+
#ifdef Py_DEBUG
242+
if (code == NULL || globals == NULL || !PyDict_Check(globals) ||
244243
(locals != NULL && !PyDict_Check(locals))) {
245244
PyErr_BadInternalCall();
246245
return NULL;
247246
}
247+
#endif
248248
ncells = PyTuple_GET_SIZE(code->co_cellvars);
249249
nfrees = PyTuple_GET_SIZE(code->co_freevars);
250250
extras = code->co_stacksize + code->co_nlocals + ncells + nfrees;

0 commit comments

Comments
 (0)