Kaydet (Commit) 67002af3 authored tarafından Victor Stinner's avatar Victor Stinner

Check error when calling PyUnicode_AppendAndDel()

üst 1a15aba7
...@@ -944,9 +944,9 @@ void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...) ...@@ -944,9 +944,9 @@ void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...)
else { else {
PyErr_Clear(); PyErr_Clear();
PyUnicode_AppendAndDel(&s, PyUnicode_FromString("???")); PyUnicode_AppendAndDel(&s, PyUnicode_FromString("???"));
if (s == NULL)
goto error;
} }
if (s == NULL)
goto error;
PyErr_SetObject(exc_class, s); PyErr_SetObject(exc_class, s);
error: error:
Py_XDECREF(tp); Py_XDECREF(tp);
......
...@@ -187,7 +187,7 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname, ...@@ -187,7 +187,7 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
HINSTANCE hDLL = NULL; HINSTANCE hDLL = NULL;
unsigned int old_mode; unsigned int old_mode;
ULONG_PTR cookie = 0; ULONG_PTR cookie = 0;
/* Don't display a message box when Python can't load a DLL */ /* Don't display a message box when Python can't load a DLL */
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
...@@ -248,8 +248,10 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname, ...@@ -248,8 +248,10 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
theInfo, theInfo,
theLength)); theLength));
} }
PyErr_SetObject(PyExc_ImportError, message); if (message != NULL) {
Py_XDECREF(message); PyErr_SetObject(PyExc_ImportError, message);
Py_DECREF(message);
}
return NULL; return NULL;
} else { } else {
char buffer[256]; char buffer[256];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment