From 0640e1161f37fd3415e9efdbde1e293efb98978c Mon Sep 17 00:00:00 2001 From: Fredrik Lundh Date: Fri, 30 Jun 2000 13:55:15 +0000 Subject: the mad patcher strikes again: -- added pickling support (only works if sre is imported) -- fixed wordsize problems in engine (instead of casting literals down to the character size, cast characters up to the literal size (same as the code word size). this prevents false hits when you're matching a unicode pattern against an 8-bit string. (unfortunately, this broke another test, but I think the test should be changed in this case; more on that on python-dev) -- added sre.purge function (unofficial, clears the cache) --- Lib/sre_compile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Lib/sre_compile.py') diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 0829c00e27..e48a7eb990 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -31,15 +31,15 @@ def _compile(code, pattern, flags): emit(OPCODES[OP_IGNORE[op]]) else: emit(OPCODES[op]) - emit(ord(av)) + emit(av) elif op is IN: if flags & SRE_FLAG_IGNORECASE: emit(OPCODES[OP_IGNORE[op]]) def fixup(literal, flags=flags): - return _sre.getlower(ord(literal), flags) + return _sre.getlower(literal, flags) else: emit(OPCODES[op]) - fixup = ord + fixup = lambda x: x skip = len(code); emit(0) for op, av in av: emit(OPCODES[op]) @@ -165,7 +165,7 @@ def _compile_info(code, pattern, flags): if not (flags & SRE_FLAG_IGNORECASE): for op, av in pattern.data: if op is LITERAL: - prefix.append(ord(av)) + prefix.append(av) else: break # add an info block -- cgit v1.2.1