[Python-checkins] r81794 - python/branches/py3k/Python/getargs.c

victor.stinner python-checkins at python.org
Sun Jun 6 22:38:02 CEST 2010


Author: victor.stinner
Date: Sun Jun  6 22:38:02 2010
New Revision: 81794

Log:
convertsimple(): call PyErr_NoMemory() on PyMem_NEW() failure

Raise a more revelant error (MemoryError instead of TypeError)


Modified:
   python/branches/py3k/Python/getargs.c

Modified: python/branches/py3k/Python/getargs.c
==============================================================================
--- python/branches/py3k/Python/getargs.c	(original)
+++ python/branches/py3k/Python/getargs.c	Sun Jun  6 22:38:02 2010
@@ -1172,6 +1172,7 @@
                 *buffer = PyMem_NEW(char, size + 1);
                 if (*buffer == NULL) {
                     Py_DECREF(s);
+                    PyErr_NoMemory();
                     return converterr(
                         "(memory error)",
                         arg, msgbuf, bufsize);
@@ -1215,6 +1216,7 @@
             *buffer = PyMem_NEW(char, size + 1);
             if (*buffer == NULL) {
                 Py_DECREF(s);
+                PyErr_NoMemory();
                 return converterr("(memory error)",
                                   arg, msgbuf, bufsize);
             }


More information about the Python-checkins mailing list