summaryrefslogtreecommitdiffstats
path: root/Lib/sre_compile.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-03-27 09:24:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-03-27 09:24:36 (GMT)
commitd732c95eb0763bf4d5bb3f6e03707828185800bb (patch)
treed2bbcfe29219e45df0bedac0a21afdb8b38c65ad /Lib/sre_compile.py
parent968c56a6264462c3db7b527cad561a929bde49b9 (diff)
downloadcpython-d732c95eb0763bf4d5bb3f6e03707828185800bb.zip
cpython-d732c95eb0763bf4d5bb3f6e03707828185800bb.tar.gz
cpython-d732c95eb0763bf4d5bb3f6e03707828185800bb.tar.bz2
Revert 1.51 booleans so that sre will still run on old pythons.
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r--Lib/sre_compile.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index b581554..7ddc097 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -203,16 +203,16 @@ def _optimize_charset(charset, fixup):
# internal: optimize character set
out = []
outappend = out.append
- charmap = [False]*256
+ charmap = [0]*256
try:
for op, av in charset:
if op is NEGATE:
outappend((op, av))
elif op is LITERAL:
- charmap[fixup(av)] = True
+ charmap[fixup(av)] = 1
elif op is RANGE:
for i in range(fixup(av[0]), fixup(av[1])+1):
- charmap[i] = True
+ charmap[i] = 1
elif op is CATEGORY:
# XXX: could append to charmap tail
return charset # cannot compress
@@ -298,17 +298,17 @@ def _optimize_unicode(charset, fixup):
import array
except ImportError:
return charset
- charmap = [False]*65536
+ charmap = [0]*65536
negate = 0
try:
for op, av in charset:
if op is NEGATE:
negate = 1
elif op is LITERAL:
- charmap[fixup(av)] = True
+ charmap[fixup(av)] = 1
elif op is RANGE:
for i in xrange(fixup(av[0]), fixup(av[1])+1):
- charmap[i] = True
+ charmap[i] = 1
elif op is CATEGORY:
# XXX: could expand category
return charset # cannot compress