[Python-checkins] cpython: Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
victor.stinner
python-checkins at python.org
Tue Nov 22 03:29:06 CET 2011
http://hg.python.org/cpython/rev/59dcb6249034
changeset: 73686:59dcb6249034
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Tue Nov 22 03:31:20 2011 +0100
summary:
Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
files:
Modules/_sre.c | 12 ++++--------
Python/bltinmodule.c | 11 ++---------
Python/traceback.c | 10 ++--------
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/Modules/_sre.c b/Modules/_sre.c
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -500,7 +500,7 @@
case SRE_OP_IN:
/* repeated set */
TRACE(("|%p|%p|COUNT IN\n", pattern, ptr));
- while (ptr < end &&
+ while (ptr < end &&
SRE_CHARSET(pattern + 2, SRE_CHARGET(state, ptr, 0)))
ptr += state->charsize;
break;
@@ -1030,7 +1030,7 @@
ctx->u.chr = ctx->pattern[ctx->pattern[0]+1];
for (;;) {
while (ctx->count >= (Py_ssize_t) ctx->pattern[1] &&
- (ctx->ptr >= end ||
+ (ctx->ptr >= end ||
SRE_CHARGET(state, ctx->ptr, 0) != ctx->u.chr)) {
ctx->ptr -= state->charsize;
ctx->count--;
@@ -1302,7 +1302,7 @@
if (!p || !e || e < p)
RETURN_FAILURE;
while (p < e) {
- if (ctx->ptr >= end ||
+ if (ctx->ptr >= end ||
SRE_CHARGET(state, ctx->ptr, 0) != SRE_CHARGET(state, p, 0))
RETURN_FAILURE;
p += state->charsize;
@@ -2664,7 +2664,7 @@
if (pattern == Py_None) {
self->logical_charsize = -1;
self->charsize = -1;
- }
+ }
else {
Py_ssize_t p_length;
if (!getstring(pattern, &p_length, &self->logical_charsize,
@@ -3021,10 +3021,8 @@
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 @@
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;
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -518,17 +518,10 @@
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 *
diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -526,23 +526,17 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list