Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d11b5e54
Commit
d11b5e54
authored
Oct 03, 2000
by
Fredrik Lundh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recompile pattern if (?x) flag was found inside the pattern during the
first scan. Closes bug #115040.
parent
4ae8ef84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
Lib/sre_parse.py
Lib/sre_parse.py
+5
-0
Lib/test/re_tests.py
Lib/test/re_tests.py
+4
-2
No files found.
Lib/sre_parse.py
View file @
d11b5e54
...
@@ -593,6 +593,11 @@ def parse(str, flags=0, pattern=None):
...
@@ -593,6 +593,11 @@ def parse(str, flags=0, pattern=None):
# p.dump()
# 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
return
p
def
parse_template
(
source
,
pattern
):
def
parse_template
(
source
,
pattern
):
...
...
Lib/test/re_tests.py
View file @
d11b5e54
...
@@ -612,9 +612,11 @@ xyzabc
...
@@ -612,9 +612,11 @@ xyzabc
(r'
(([
a
-
z
]
+
):)
?
([
a
-
z
]
+
)
$
', '
smil
', SUCCEED, '
g1
+
"-"
+
g2
+
"-"
+
g3
', '
None
-
None
-
smil
'),
(r'
(([
a
-
z
]
+
):)
?
([
a
-
z
]
+
)
$
', '
smil
', SUCCEED, '
g1
+
"-"
+
g2
+
"-"
+
g3
', '
None
-
None
-
smil
'),
# bug 111869 (PRE/PCRE fails on this one, SRE doesn'
t
)
# bug 111869 (PRE/PCRE fails on this one, SRE doesn'
t
)
(
r'.*d'
,
'abc
\
n
abd'
,
SUCCEED
,
'found'
,
'abd'
),
(
r'.*d'
,
'abc
\
n
abd'
,
SUCCEED
,
'found'
,
'abd'
),
# bug 112468
# bug 112468
: various expected syntax errors
(
'('
,
''
,
SYNTAX_ERROR
),
(
'('
,
''
,
SYNTAX_ERROR
),
(
'[
\
\
41]'
,
'!'
,
SUCCEED
,
'found'
,
'!'
),
(
'[
\
\
41]'
,
'!'
,
SUCCEED
,
'found'
,
'!'
),
# bug 115618
# bug 115040: rescan if flags are modified inside pattern
(
r' (?x)foo '
,
'foo'
,
SUCCEED
,
'found'
,
'foo'
),
# bug 115618: negative lookahead
(
r'(?<!abc)(d.f)'
,
'abcdefdof'
,
SUCCEED
,
'found'
,
'dof'
),
(
r'(?<!abc)(d.f)'
,
'abcdefdof'
,
SUCCEED
,
'found'
,
'dof'
),
]
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment