]> granicus.if.org Git - python/commitdiff
Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 22 Nov 2011 02:31:20 +0000 (03:31 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 22 Nov 2011 02:31:20 +0000 (03:31 +0100)
Modules/_sre.c
Python/bltinmodule.c
Python/traceback.c

index 56f35c316f648e96f439601375f5f4a242c158dd..0069d82956b53337fec22673c7f4ec56cbca6e0d 100644 (file)
@@ -500,7 +500,7 @@ SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, Py_ssize_t maxcount)
     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 @@ entrance:
                 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 @@ entrance:
                     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 @@ _compile(PyObject* self_, PyObject* args)
     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 @@ _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;
index 871eaa3497817fe5c1567940a501a05bdd8e0df3..13349cc7bb18928471bc339271ca96ff1a28e322 100644 (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 *
index 2f4653bce63e0d4d77c83e5dab46a4841481ec84..c8b3ee1b63f930e72f378d20d5b1304472de39ba 100644 (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)