[Python-checkins] cpython: unicode_char() uses get_latin1_char() to get latin1 singleton characters

victor.stinner python-checkins at python.org
Fri Jan 3 13:16:31 CET 2014


http://hg.python.org/cpython/rev/fb8802277613
changeset:   88272:fb8802277613
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Jan 03 13:16:00 2014 +0100
summary:
  unicode_char() uses get_latin1_char() to get latin1 singleton characters

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1772,6 +1772,9 @@
 
     assert(ch <= MAX_UNICODE);
 
+    if (ch < 256)
+        return get_latin1_char(ch);
+
     unicode = PyUnicode_New(1, ch);
     if (unicode == NULL)
         return NULL;

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


More information about the Python-checkins mailing list