summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-21 01:01:41 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-21 01:01:41 (GMT)
commit333544764619b8e338b7485ea94b9be9b9e75a9d (patch)
treeda0738d3cce74dbc11379c145097277d0fd9ddb6 /Python
parent53b33e767d9aa85f2bf3add5850499596f9d0558 (diff)
downloadcpython-333544764619b8e338b7485ea94b9be9b9e75a9d.zip
cpython-333544764619b8e338b7485ea94b9be9b9e75a9d.tar.gz
cpython-333544764619b8e338b7485ea94b9be9b9e75a9d.tar.bz2
Check for PyUnicode_AS_UNICODE() failure
Diffstat (limited to 'Python')
-rw-r--r--Python/dynload_win.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index c620e58..e511098 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -176,11 +176,16 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
{
dl_funcptr p;
char funcname[258], *import_python;
+ wchar_t *wpathname;
#ifndef _DEBUG
_Py_CheckPython3();
#endif
+ wpathname = PyUnicode_AsUnicode(pathname);
+ if (wpathname == NULL)
+ return NULL;
+
PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
{
@@ -195,7 +200,7 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
/* We use LoadLibraryEx so Windows looks for dependent DLLs
in directory of pathname first. */
/* XXX This call doesn't exist in Windows CE */
- hDLL = LoadLibraryExW(PyUnicode_AS_UNICODE(pathname), NULL,
+ hDLL = LoadLibraryExW(wpathname, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
_Py_DeactivateActCtx(cookie);