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

Skip to content

Commit 22af259

Browse files
committed
Issue #19437: Fix PyImport_ImportModuleLevelObject(), handle
PyUnicode_Substring() failure (ex: MemoryError)
1 parent d3e83e2 commit 22af259

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/import.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
13641364
goto error;
13651365
}
13661366
}
1367+
13671368
base = PyUnicode_Substring(package, 0, last_dot);
1369+
if (base == NULL)
1370+
goto error;
1371+
13681372
if (PyUnicode_GET_LENGTH(name) > 0) {
13691373
PyObject *borrowed_dot, *seq = NULL;
13701374

0 commit comments

Comments
 (0)