[Python-checkins] CVS: python/dist/src/Lib sre_parse.py,1.44,1.45
Fredrik Lundh
effbot@users.sourceforge.net
Sun, 18 Feb 2001 13:04:50 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv18070/Lib
Modified Files:
sre_parse.py
Log Message:
detect attempts to repeat anchors (fixes bug #130748)
Index: sre_parse.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** sre_parse.py 2001/02/18 12:05:16 1.44
--- sre_parse.py 2001/02/18 21:04:48 1.45
***************
*** 447,450 ****
--- 447,451 ----
elif this == "*":
min, max = 0, MAXREPEAT
+
elif this == "+":
min, max = 1, MAXREPEAT
***************
*** 476,479 ****
--- 477,482 ----
item = subpattern[-1:]
else:
+ item = None
+ if not item or (len(item) == 1 and item[0][0] == AT):
raise error, "nothing to repeat"
if item[0][0] in (MIN_REPEAT, MAX_REPEAT):