summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-10-03 19:22:26 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-10-03 19:22:26 (GMT)
commitd11b5e54f0e9ac51fbb49ebe5f1fc0626d59fc55 (patch)
tree80b6cae9c4cc386143ac9c395a985e981e0cded5 /Lib/sre_parse.py
parent4ae8ef84da19892b828b9649a9565e967be4c0bd (diff)
downloadcpython-d11b5e54f0e9ac51fbb49ebe5f1fc0626d59fc55.zip
cpython-d11b5e54f0e9ac51fbb49ebe5f1fc0626d59fc55.tar.gz
cpython-d11b5e54f0e9ac51fbb49ebe5f1fc0626d59fc55.tar.bz2
Recompile pattern if (?x) flag was found inside the pattern during the
first scan. Closes bug #115040.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r--Lib/sre_parse.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index f4741c9..fcf5bcc 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -593,6 +593,11 @@ def parse(str, flags=0, pattern=None):
# p.dump()
+ if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE:
+ # the VERBOSE flag was switched on inside the pattern. to be
+ # on the safe side, we'll parse the whole thing again...
+ return parse(str, p.pattern.flags)
+
return p
def parse_template(source, pattern):