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
13ac9926
Commit
13ac9926
authored
Oct 07, 2000
by
Fredrik Lundh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed too ambitious "nothing to repeat" check. Closes bug #114033.
parent
5c0b43d1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
3 deletions
+6
-3
Lib/sre_compile.py
Lib/sre_compile.py
+1
-1
Lib/sre_constants.py
Lib/sre_constants.py
+2
-0
Lib/sre_parse.py
Lib/sre_parse.py
+0
-2
Lib/test/re_tests.py
Lib/test/re_tests.py
+3
-0
No files found.
Lib/sre_compile.py
View file @
13ac9926
...
...
@@ -222,7 +222,7 @@ def _optimize_charset(charset, fixup):
def
_simple
(
av
):
# check if av is a "simple" operator
lo
,
hi
=
av
[
2
].
getwidth
()
if
lo
==
0
:
if
lo
==
0
and
hi
==
MAXREPEAT
:
raise
error
,
"nothing to repeat"
return
lo
==
hi
==
1
and
av
[
2
][
0
][
0
]
!=
SUBPATTERN
...
...
Lib/sre_constants.py
View file @
13ac9926
...
...
@@ -9,6 +9,8 @@
# See the sre.py file for information on usage and redistribution.
#
MAXREPEAT
=
65535
# should this really be here?
class
error
(
Exception
):
...
...
Lib/sre_parse.py
View file @
13ac9926
...
...
@@ -12,8 +12,6 @@ import string, sys
from
sre_constants
import
*
MAXREPEAT
=
65535
SPECIAL_CHARS
=
".
\
\
[{()*+?^$|"
REPEAT_CHARS
=
"*+?{"
...
...
Lib/test/re_tests.py
View file @
13ac9926
...
...
@@ -615,10 +615,13 @@ xyzabc
# bug 112468: various expected syntax errors
(
'('
,
''
,
SYNTAX_ERROR
),
(
'[
\
\
41]'
,
'!'
,
SUCCEED
,
'found'
,
'!'
),
# bug 114033: nothing to repeat
(
r'(x?)?'
,
'x'
,
SUCCEED
,
'found'
,
'x'
),
# 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'
),
# bug 116251: character class bug
(
r'[\
w-]+
', '
laser_beam
', SUCCEED, '
found
', '
laser_beam
'),
]
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