[Python-checkins] cpython: PyUnicode_FSDecoder() ensures that the decoded string is ready

victor.stinner python-checkins at python.org
Thu Oct 27 01:55:22 CEST 2011


http://hg.python.org/cpython/rev/e7340f2a42eb
changeset:   73140:e7340f2a42eb
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Oct 27 01:56:33 2011 +0200
summary:
  PyUnicode_FSDecoder() ensures that the decoded string is ready

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3318,6 +3318,10 @@
             return 0;
         }
     }
+    if (PyUnicode_READY(output) < 0) {
+        Py_DECREF(output);
+        return 0;
+    }
     if (findchar(PyUnicode_DATA(output), PyUnicode_KIND(output),
                  PyUnicode_GET_LENGTH(output), 0, 1) >= 0) {
         PyErr_SetString(PyExc_TypeError, "embedded NUL character");

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


More information about the Python-checkins mailing list