Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4ccea94

Browse files
author
Fredrik Lundh
committed
- reverted to "\x is binary byte"
- removed evil tabs from sre_parse and sre_compile
1 parent 1739be5 commit 4ccea94

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/sre_compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def fixup(literal, flags=flags):
3939
return _sre.getlower(literal, flags)
4040
else:
4141
emit(OPCODES[op])
42-
fixup = lambda x: x
42+
fixup = lambda x: x
4343
skip = len(code); emit(0)
4444
for op, av in av:
4545
emit(OPCODES[op])

Lib/sre_parse.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
# FIXME: should be 65535, but the arraymodule is still broken
2020
MAXREPEAT = 32767
2121

22-
# FIXME: same here
23-
CHARMASK = 0x7fff
22+
# FIXME: might change in 2.0 final. but for now, this seems
23+
# to be the best way to be compatible with 1.5.2
24+
CHARMASK = 0xff
2425

2526
SPECIAL_CHARS = ".\\[{()*+?^$|"
2627
REPEAT_CHARS = "*+?{"
@@ -616,9 +617,9 @@ def expand_template(template, match):
616617
a = p.append
617618
sep = match.string[:0]
618619
if type(sep) is type(""):
619-
char = chr
620+
char = chr
620621
else:
621-
char = unichr
622+
char = unichr
622623
for c, s in template:
623624
if c is LITERAL:
624625
a(char(s))

Lib/test/output/test_sre

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
test_sre
2-
=== Failed incorrectly ('\\x00ffffffffffffff', '\377', 0, 'found', '\377')
32
=== Failed incorrectly ('^(.+)?B', 'AB', 0, 'g1', 'A')
43
=== Failed incorrectly ('(a+)+\\1', 'aa', 0, 'found+"-"+g1', 'aa-a')
54
=== grouping error ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', 0, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/') 'd:msgs/tdir/sub1/-trial/' should be 'd:msgs/tdir/sub1/-tdir/'

0 commit comments

Comments
 (0)