]> granicus.if.org Git - python/commitdiff
I know this is only a temporary stop-gap measure, but the match() and
authorGuido van Rossum <guido@python.org>
Tue, 2 May 2000 15:52:33 +0000 (15:52 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 2 May 2000 15:52:33 +0000 (15:52 +0000)
search() functions didn't even work because _fixflags() isn't
idempotent.  I'm adding another stop-gap measure so that you can at
least use sre.search() and sre.match() with a zero flags arg.

Lib/sre.py

index 0b4105721f2622d6e971444aaf867d4d8b6a9226..79878b35c4a7e800ae4811d60e356c3cbadcc2f9 100644 (file)
@@ -31,7 +31,6 @@ def match(pattern, string, flags=0):
     return compile(pattern, _fixflags(flags)).match(string)
 
 def search(pattern, string, flags=0):
-    assert flags == 0
     return compile(pattern, _fixflags(flags)).search(string)
 
 # FIXME: etc
@@ -41,6 +40,6 @@ def search(pattern, string, flags=0):
 
 def _fixflags(flags):
     # convert flag bitmask to sequence
-    assert flags == 0
+    assert not flags
     return ()