summaryrefslogtreecommitdiffstats
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-20 06:48:07 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-20 06:48:07 (GMT)
commite20973926a2ec19c4b87e460dc6f0edb478ce352 (patch)
treecc6843f8f0088c5ee37239afb65faaa0064654c2 /Python/importdl.c
parent3c38e066b1a0e600575b2c72207b0f1ac85073cc (diff)
parent144f77a981ecad8884e1a4e70db72e6fdb609103 (diff)
downloadcpython-e20973926a2ec19c4b87e460dc6f0edb478ce352.zip
cpython-e20973926a2ec19c4b87e460dc6f0edb478ce352.tar.gz
cpython-e20973926a2ec19c4b87e460dc6f0edb478ce352.tar.bz2
Issue #28715: Added error checks for PyUnicode_AsUTF8().
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index ac03289..f56fa94 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -147,6 +147,10 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
/* Package context is needed for single-phase init */
oldcontext = _Py_PackageContext;
_Py_PackageContext = PyUnicode_AsUTF8(name_unicode);
+ if (_Py_PackageContext == NULL) {
+ _Py_PackageContext = oldcontext;
+ goto error;
+ }
m = p0();
_Py_PackageContext = oldcontext;