[Python-checkins] cpython: Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure

victor.stinner python-checkins at python.org
Tue Jul 9 00:53:47 CEST 2013


http://hg.python.org/cpython/rev/ba79f6a86300
changeset:   84517:ba79f6a86300
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 09 00:27:12 2013 +0200
summary:
  Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure
(MemoryError).

files:
  Modules/_ctypes/callproc.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -620,6 +620,8 @@
         assert(dict->paramfunc);
         /* If it has an stgdict, it is a CDataObject */
         carg = dict->paramfunc((CDataObject *)obj);
+        if (carg == NULL)
+            return -1;
         pa->ffi_type = carg->pffi_type;
         memcpy(&pa->value, &carg->value, sizeof(pa->value));
         pa->keep = (PyObject *)carg;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list