diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-09-18 20:55:24 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-09-18 20:55:24 (GMT) |
commit | 59b68656f846973840953220c4780f3558b59fb8 (patch) | |
tree | 6a91ff46e00681f594aa3c9280d268627d009cc5 /Lib/sre_parse.py | |
parent | ab3b0343b89b4683148dadaf89728ee1198ebee5 (diff) | |
download | cpython-59b68656f846973840953220c4780f3558b59fb8.zip cpython-59b68656f846973840953220c4780f3558b59fb8.tar.gz cpython-59b68656f846973840953220c4780f3558b59fb8.tar.bz2 |
fixed #449964: sre.sub raises an exception if the template contains a
\g<x> group reference followed by a character escape
(also restructured a few things on the way to fixing #449000)
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index af1edbf..7d9b889 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -647,9 +647,9 @@ def parse_template(source, pattern): p.append((LITERAL, literal)) sep = source[:0] if type(sep) is type(""): - char = chr + makechar = chr else: - char = unichr + makechar = unichr while 1: this = s.get() if this is None: @@ -693,14 +693,14 @@ def parse_template(source, pattern): break if not code: this = this[1:] - code = LITERAL, char(atoi(this[-6:], 8) & 0xff) + code = LITERAL, makechar(atoi(this[-6:], 8) & 0xff) if code[0] is LITERAL: literal(code[1]) else: a(code) else: try: - this = char(ESCAPES[this][1]) + this = makechar(ESCAPES[this][1]) except KeyError: pass literal(this) |