Skip to content

Commit 323385d

Browse files
committed
Goto error immediately if we can't get handle to io.open
1 parent 6b81561 commit 323385d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Objects/call.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,9 +729,6 @@ _Py_COMP_DIAG_POP
729729
PyObject * _PyObject_CallMethodFormat(PyThreadState *tstate, PyObject *callable,
730730
const char *format, ...)
731731
{
732-
if (callable == NULL) {
733-
return NULL;
734-
}
735732
va_list va;
736733
va_start(va, format);
737734
PyObject *retval = callmethod(tstate, callable, format, va);

Python/traceback.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject *
415415
npath = PyList_Size(syspath);
416416

417417
open = PyObject_GetAttr(io, &_Py_ID(open));
418+
if (open == NULL) {
419+
goto error;
420+
}
418421
for (i = 0; i < npath; i++) {
419422
v = PyList_GetItem(syspath, i);
420423
if (v == NULL) {

0 commit comments

Comments
 (0)