[Python-checkins] cpython (3.3): Move PyErr_NoMemory() closer to the failure.

stefan.krah python-checkins at python.org
Fri Nov 8 21:14:22 CET 2013


http://hg.python.org/cpython/rev/73b6225ae9cd
changeset:   87018:73b6225ae9cd
branch:      3.3
user:        Stefan Krah <skrah at bytereef.org>
date:        Fri Nov 08 18:05:02 2013 +0100
summary:
  Move PyErr_NoMemory() closer to the failure.

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


diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -3108,6 +3108,7 @@
 {
     char *dest = PyMem_Malloc(size+1);
     if (dest == NULL) {
+        PyErr_NoMemory();
         return NULL;
     }
 
@@ -3186,7 +3187,6 @@
             replace_fillchar = 1;
             fmt = dec_strdup(fmt, size);
             if (fmt == NULL) {
-                PyErr_NoMemory();
                 return NULL;
             }
             fmt[0] = '_';

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


More information about the Python-checkins mailing list