[Python-checkins] cpython: PyUnicode_New() and unicode_putchar() check for MAX_UNICODE maximum (U+10FFFF)

victor.stinner python-checkins at python.org
Wed Feb 22 13:58:42 CET 2012


http://hg.python.org/cpython/rev/8722f1b7dd95
changeset:   75170:8722f1b7dd95
user:        Victor Stinner <vstinner at wyplay.com>
date:        Wed Feb 22 13:36:20 2012 +0100
summary:
  PyUnicode_New() and unicode_putchar() check for MAX_UNICODE maximum (U+10FFFF)

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -998,6 +998,7 @@
             is_sharing = 1;
     }
     else {
+        assert(maxchar <= MAX_UNICODE);
         kind_state = PyUnicode_4BYTE_KIND;
         char_size = 4;
         if (sizeof(wchar_t) == 4)
@@ -1627,6 +1628,7 @@
 unicode_putchar(PyObject **p_unicode, Py_ssize_t *pos,
                 Py_UCS4 ch)
 {
+    assert(ch <= MAX_UNICODE);
     if (unicode_widen(p_unicode, ch) < 0)
         return -1;
     PyUnicode_WRITE(PyUnicode_KIND(*p_unicode),

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


More information about the Python-checkins mailing list