]> granicus.if.org Git - python/commitdiff
SF Patch #926375: Remove a useless UTF-16 support code that is never
authorHye-Shik Chang <hyeshik@gmail.com>
Tue, 6 Apr 2004 07:24:51 +0000 (07:24 +0000)
committerHye-Shik Chang <hyeshik@gmail.com>
Tue, 6 Apr 2004 07:24:51 +0000 (07:24 +0000)
been used. (Suggested by Martin v. Loewis)

Objects/unicodeobject.c

index e3bef575406fc9aeec9ed29fadc5a1ac781cef8b..ada01fc2937beed90ad8f2c7d67e70f086380ea3 100644 (file)
@@ -405,7 +405,7 @@ int PyUnicode_AsWideChar(PyUnicodeObject *unicode,
 
 PyObject *PyUnicode_FromOrdinal(int ordinal)
 {
-    Py_UNICODE s[2];
+    Py_UNICODE s[1];
 
 #ifdef Py_UNICODE_WIDE
     if (ordinal < 0 || ordinal > 0x10ffff) {
@@ -423,23 +423,8 @@ PyObject *PyUnicode_FromOrdinal(int ordinal)
     }
 #endif
 
-    if (ordinal <= 0xffff) {
-       /* UCS-2 character */
-       s[0] = (Py_UNICODE) ordinal;
-       return PyUnicode_FromUnicode(s, 1);
-    }
-    else {
-#ifndef Py_UNICODE_WIDE
-       /* UCS-4 character.  store as two surrogate characters */
-       ordinal -= 0x10000L;
-       s[0] = 0xD800 + (Py_UNICODE) (ordinal >> 10);
-       s[1] = 0xDC00 + (Py_UNICODE) (ordinal & 0x03FF);
-       return PyUnicode_FromUnicode(s, 2);
-#else
-       s[0] = (Py_UNICODE)ordinal;
-       return PyUnicode_FromUnicode(s, 1);
-#endif
-    }
+    s[0] = (Py_UNICODE)ordinal;
+    return PyUnicode_FromUnicode(s, 1);
 }
 
 PyObject *PyUnicode_FromObject(register PyObject *obj)