summaryrefslogtreecommitdiff
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-20 08:48:30 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-20 08:48:30 +0200
commitf6f15918087f2fae652634303a79f9cc6bc421ce (patch)
tree93cd0cfea2b6c6a142df1d337538c73b0003e960 /Python/importdl.c
parent52d0eb2dc0728b68b1aaac06936d19a84ffe9a75 (diff)
parente20973926a2ec19c4b87e460dc6f0edb478ce352 (diff)
downloadcpython-git-f6f15918087f2fae652634303a79f9cc6bc421ce.tar.gz
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 ac03289c4d..f56fa94cc4 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;