Issue545855
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-04-18 22:22 by barry, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Messages (3) | |||
---|---|---|---|
msg10413 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2002-04-18 22:22 | |
re.compile('foo[a-') raises a TypeError exception instead of re.error. Python 2.2.1 (#1, Apr 4 2002, 17:22:15) [GCC 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> re.compile('foo[a-') Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.2/sre.py", line 178, in compile return _compile(pattern, flags) File "/usr/local/lib/python2.2/sre.py", line 226, in _compile p = sre_compile.compile(pattern, flags) File "/usr/local/lib/python2.2/sre_compile.py", line 430, in compile p = sre_parse.parse(p, flags) File "/usr/local/lib/python2.2/sre_parse.py", line 623, in parse p = _parse_sub(source, pattern, 0) File "/usr/local/lib/python2.2/sre_parse.py", line 318, in _parse_sub items.append(_parse(source, state)) File "/usr/local/lib/python2.2/sre_parse.py", line 424, in _parse if this[0] == "\\": TypeError: unsubscriptable object |
|||
msg10414 - (view) | Author: Michael Stone (mbrierst) | Date: 2003-02-04 20:02 | |
Logged In: YES user_id=670441 Patch below fixes the problem. Didn't check for end of expression in one case. Index: dist/src/Lib/sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.55 diff -c -r1.55 sre_parse.py *** dist/src/Lib/sre_parse.py 2 Jun 2002 00:40:05 -0000 1.55 --- dist/src/Lib/sre_parse.py 4 Feb 2003 19:53:14 -0000 *************** *** 420,429 **** set.append((LITERAL, ord("-"))) break else: ! if this[0] == "\\": code2 = _class_escape(source, this) ! else: code2 = LITERAL, ord(this) if code1[0] != LITERAL or code2[0] != LITERAL: raise error, "bad character range" lo = code1[1] --- 420,431 ---- set.append((LITERAL, ord("-"))) break else: ! if this and this[0] == "\\": code2 = _class_escape(source, this) ! elif this: code2 = LITERAL, ord(this) + else: + raise error, "unexpected end of regular expression" if code1[0] != LITERAL or code2[0] != LITERAL: raise error, "bad character range" lo = code1[1] |
|||
msg10415 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2003-05-17 01:53 | |
Logged In: YES user_id=357491 This is fixed in 2.2.2 and 2.3b1. Closing as out of date. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:14 | admin | set | github: 36465 |
2002-04-18 22:22:48 | barry | create |