]> granicus.if.org Git - python/commitdiff
unicode_char() uses get_latin1_char() to get latin1 singleton characters
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 3 Jan 2014 12:16:00 +0000 (13:16 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 3 Jan 2014 12:16:00 +0000 (13:16 +0100)
Objects/unicodeobject.c

index 1fb5742317b587292f17652001322b7e347045c4..b2279a652d8508151ee84dd1571fd8c063056ba8 100644 (file)
@@ -1772,6 +1772,9 @@ unicode_char(Py_UCS4 ch)
 
     assert(ch <= MAX_UNICODE);
 
+    if (ch < 256)
+        return get_latin1_char(ch);
+
     unicode = PyUnicode_New(1, ch);
     if (unicode == NULL)
         return NULL;