mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
SF Patch #926375: Remove a useless UTF-16 support code that is never
been used. (Suggested by Martin v. Loewis)
This commit is contained in:
parent
8a5c3c76be
commit
4057483164
1 changed files with 3 additions and 18 deletions
|
@ -405,7 +405,7 @@ int PyUnicode_AsWideChar(PyUnicodeObject *unicode,
|
||||||
|
|
||||||
PyObject *PyUnicode_FromOrdinal(int ordinal)
|
PyObject *PyUnicode_FromOrdinal(int ordinal)
|
||||||
{
|
{
|
||||||
Py_UNICODE s[2];
|
Py_UNICODE s[1];
|
||||||
|
|
||||||
#ifdef Py_UNICODE_WIDE
|
#ifdef Py_UNICODE_WIDE
|
||||||
if (ordinal < 0 || ordinal > 0x10ffff) {
|
if (ordinal < 0 || ordinal > 0x10ffff) {
|
||||||
|
@ -423,23 +423,8 @@ PyObject *PyUnicode_FromOrdinal(int ordinal)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ordinal <= 0xffff) {
|
s[0] = (Py_UNICODE)ordinal;
|
||||||
/* UCS-2 character */
|
return PyUnicode_FromUnicode(s, 1);
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *PyUnicode_FromObject(register PyObject *obj)
|
PyObject *PyUnicode_FromObject(register PyObject *obj)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue