[Python-checkins] cpython: Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure

victor.stinner python-checkins at python.org
Sat Jun 16 03:24:24 CEST 2012


http://hg.python.org/cpython/rev/068f2bb0c0ae
changeset:   77463:068f2bb0c0ae
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Jun 16 03:17:34 2012 +0200
summary:
  Fix unicode_adjust_maxchar(): catch PyUnicode_New() failure

files:
  Objects/unicodeobject.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2084,7 +2084,8 @@
             return;
     }
     copy = PyUnicode_New(len, max_char);
-    _PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
+    if (copy != NULL)
+        _PyUnicode_FastCopyCharacters(copy, 0, unicode, 0, len);
     Py_DECREF(unicode);
     *p_unicode = copy;
 }

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


More information about the Python-checkins mailing list