[Python-checkins] cpython: Check error when calling PyUnicode_AppendAndDel()
victor.stinner
python-checkins at python.org
Mon Oct 3 03:45:16 CEST 2011
http://hg.python.org/cpython/rev/8d29cdf28216
changeset: 72592:8d29cdf28216
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Sun Oct 02 20:35:10 2011 +0200
summary:
Check error when calling PyUnicode_AppendAndDel()
files:
Modules/_ctypes/callproc.c | 4 ++--
Python/dynload_win.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -944,9 +944,9 @@
else {
PyErr_Clear();
PyUnicode_AppendAndDel(&s, PyUnicode_FromString("???"));
- if (s == NULL)
- goto error;
}
+ if (s == NULL)
+ goto error;
PyErr_SetObject(exc_class, s);
error:
Py_XDECREF(tp);
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -187,7 +187,7 @@
HINSTANCE hDLL = NULL;
unsigned int old_mode;
ULONG_PTR cookie = 0;
-
+
/* Don't display a message box when Python can't load a DLL */
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
@@ -248,8 +248,10 @@
theInfo,
theLength));
}
- PyErr_SetObject(PyExc_ImportError, message);
- Py_XDECREF(message);
+ if (message != NULL) {
+ PyErr_SetObject(PyExc_ImportError, message);
+ Py_DECREF(message);
+ }
return NULL;
} else {
char buffer[256];
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list