Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide

This commit is contained in:
Victor Stinner 2011-11-22 03:31:20 +01:00
parent 0d3721d986
commit 63ab875cfe
3 changed files with 8 additions and 25 deletions

View File

@ -3021,10 +3021,8 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
GET_ARG; max = arg;
if (min > max)
FAIL;
#ifdef Py_UNICODE_WIDE
if (max > 65535)
FAIL;
#endif
if (!_validate_inner(code, code+skip-4, groups))
FAIL;
code += skip-4;
@ -3042,10 +3040,8 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
GET_ARG; max = arg;
if (min > max)
FAIL;
#ifdef Py_UNICODE_WIDE
if (max > 65535)
FAIL;
#endif
if (!_validate_inner(code, code+skip-3, groups))
FAIL;
code += skip-3;

View File

@ -518,17 +518,10 @@ builtin_chr(PyObject *self, PyObject *args)
return PyUnicode_FromOrdinal(x);
}
PyDoc_VAR(chr_doc) = PyDoc_STR(
PyDoc_STRVAR(chr_doc,
"chr(i) -> Unicode character\n\
\n\
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."
)
#ifndef Py_UNICODE_WIDE
PyDoc_STR(
"\nIf 0x10000 <= i, a surrogate pair is returned."
)
#endif
;
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
static char *

View File

@ -526,23 +526,17 @@ dump_ascii(int fd, PyObject *text)
char c = (char)ch;
write(fd, &c, 1);
}
else if (ch < 256) {
else if (ch < 0xff) {
PUTS(fd, "\\x");
dump_hexadecimal(2, ch, fd);
}
else
#ifdef Py_UNICODE_WIDE
if (ch < 65536)
#endif
{
else if (ch < 0xffff) {
PUTS(fd, "\\u");
dump_hexadecimal(4, ch, fd);
#ifdef Py_UNICODE_WIDE
}
else {
PUTS(fd, "\\U");
dump_hexadecimal(8, ch, fd);
#endif
}
}
if (truncated)