Issue6650
Created on 2009-08-05 17:14 by torne, last changed 2009-08-05 17:14 by torne.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
sre_error_msg.diff
|
torne,
2009-08-05 17:14
|
patch with a nicer error message |
|
|
|
msg91324 - (view) |
Author: Torne Wuff (torne) |
Date: 2009-08-05 17:14 |
|
sre_parse raises an exception with the message "syntax error" - very
generic and confusing - in the case where something that looks like a
lookbehind assertion is invalid.
>>> import re
>>> re.match('(?<foo>.*)', 'foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/re.py", line 137, in match
return _compile(pattern, flags).match(string)
File "/usr/lib/python2.5/re.py", line 241, in _compile
raise error, v # invalid expression
sre_constants.error: syntax error
This example is a typo for '(?P<foo>.*)' :)
This is the only case in sre_parse where the message "syntax error" is
used - the others are much more descriptive. Attached patch changes it
to "bad lookbehind assertion type: %s" for python 2.x head; should be
applied to 3.x also.
|
|
| Date |
User |
Action |
Args |
| 2009-08-05 17:14:38 | torne | create | |
|