[New-bugs-announce] [issue20426] Compiling a regex with re.DEBUG should force a recompile
leewz
report at bugs.python.org
Tue Jan 28 23:09:38 CET 2014
New submission from leewz:
Compiling a regex with the `re.DEBUG` flag indicates that the user wants to see the debug output. `re.compile` is cached, though, so there is the possibility of no output.
Example:
import re
re.compile('1',re.DEBUG) #expected output
re.compile('1',re.DEBUG) #no output
re.compile('',re.DEBUG) #no output (empty regex)
The workaround is to call `re.purge()`, which may remove other cached regexes that are still in use.
(Background: I wanted to check for equivalence of regexes, and a StackOverflow answer suggested comparing their `re.DEBUG`. http://stackoverflow.com/a/21398362/2963903)
----------
components: Regular Expressions
messages: 209595
nosy: ezio.melotti, leewz, mrabarnett
priority: normal
severity: normal
status: open
title: Compiling a regex with re.DEBUG should force a recompile
type: behavior
versions: Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20426>
_______________________________________
More information about the New-bugs-announce
mailing list