summaryrefslogtreecommitdiff
path: root/Python/dynload_hpux.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-10-19 15:50:36 +0100
committerGitHub <noreply@github.com>2020-10-19 15:50:36 +0100
commitc82f10450c547eb94a04ee17b7c816ff31948297 (patch)
treead305c05c5745e1a5e7c136545bec7eefa741e32 /Python/dynload_hpux.c
parenteee6bb50c69d94280f43b47390ea9d1b5f42930c (diff)
parentb580ed1d9d55461d8dde027411b90be26cae131e (diff)
downloadcpython-git-bpo-39107.tar.gz
Merge branch 'master' into bpo-39107bpo-39107
Diffstat (limited to 'Python/dynload_hpux.c')
-rw-r--r--Python/dynload_hpux.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/dynload_hpux.c b/Python/dynload_hpux.c
index 4b964a69d3..e36d608c6d 100644
--- a/Python/dynload_hpux.c
+++ b/Python/dynload_hpux.c
@@ -36,9 +36,20 @@ dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
char buf[256];
PyOS_snprintf(buf, sizeof(buf), "Failed to load %.200s",
pathname);
- PyObject *buf_ob = PyUnicode_FromString(buf);
+ PyObject *buf_ob = PyUnicode_DecodeFSDefault(buf);
+ if (buf_ob == NULL)
+ return NULL;
PyObject *shortname_ob = PyUnicode_FromString(shortname);
- PyObject *pathname_ob = PyUnicode_FromString(pathname);
+ if (shortname_ob == NULL) {
+ Py_DECREF(buf_ob);
+ return NULL;
+ }
+ PyObject *pathname_ob = PyUnicode_DecodeFSDefault(pathname);
+ if (pathname_ob == NULL) {
+ Py_DECREF(buf_ob);
+ Py_DECREF(shortname_ob);
+ return NULL;
+ }
PyErr_SetImportError(buf_ob, shortname_ob, pathname_ob);
Py_DECREF(buf_ob);
Py_DECREF(shortname_ob);