Message293736
When compile a regular expression with groups or conditionals emitted warnings point on lines in the re module implementation rather than the line in user code.
>>> import re
>>> re.compile('x(?i)')
__main__:1: DeprecationWarning: Flags not at the start of the expression x(?i)
re.compile('x(?i)', re.IGNORECASE)
>>> re.compile('(x(?i))')
/home/serhiy/py/cpython/Lib/re.py:281: DeprecationWarning: Flags not at the start of the expression (x(?i))
p = sre_compile.compile(pattern, flags)
re.compile('(x(?i))', re.IGNORECASE)
>>> re.compile('((x(?i)))')
/home/serhiy/py/cpython/Lib/sre_parse.py:889: DeprecationWarning: Flags not at the start of the expression ((x(?i)))
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, False)
re.compile('((x(?i)))', re.IGNORECASE)
Proposed patch fixes this:
>>> import re
>>> re.compile('x(?i)')
__main__:1: DeprecationWarning: Flags not at the start of the expression x(?i)
re.compile('x(?i)', re.IGNORECASE)
>>> re.compile('(x(?i))')
__main__:1: DeprecationWarning: Flags not at the start of the expression (x(?i))
re.compile('(x(?i))', re.IGNORECASE)
>>> re.compile('((x(?i)))')
__main__:1: DeprecationWarning: Flags not at the start of the expression ((x(?i)))
re.compile('((x(?i)))', re.IGNORECASE) |
|
Date |
User |
Action |
Args |
2017-05-15 19:47:50 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ezio.melotti, mrabarnett |
2017-05-15 19:47:50 | serhiy.storchaka | set | messageid: <1494877670.21.0.548090172972.issue30375@psf.upfronthosting.co.za> |
2017-05-15 19:47:50 | serhiy.storchaka | link | issue30375 messages |
2017-05-15 19:47:50 | serhiy.storchaka | create | |
|