diff options
-rw-r--r-- | Modules/_sre.c | 12 | ||||
-rw-r--r-- | Python/bltinmodule.c | 11 | ||||
-rw-r--r-- | Python/traceback.c | 10 |
3 files changed, 8 insertions, 25 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 56f35c3..0069d82 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -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; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 871eaa3..13349cc 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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 * diff --git a/Python/traceback.c b/Python/traceback.c index 2f4653b..c8b3ee1 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -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) |