From d732c95eb0763bf4d5bb3f6e03707828185800bb Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 27 Mar 2004 09:24:36 +0000 Subject: Revert 1.51 booleans so that sre will still run on old pythons. --- Lib/sre_compile.py | 12 ++++++------ 1 file 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 -- cgit v0.12