mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
I know this is only a temporary stop-gap measure, but the match() and
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.
This commit is contained in:
parent
823eb4ba81
commit
1b6aecb08c
1 changed files with 1 additions and 2 deletions
|
@ -31,7 +31,6 @@ def match(pattern, string, flags=0):
|
||||||
return compile(pattern, _fixflags(flags)).match(string)
|
return compile(pattern, _fixflags(flags)).match(string)
|
||||||
|
|
||||||
def search(pattern, string, flags=0):
|
def search(pattern, string, flags=0):
|
||||||
assert flags == 0
|
|
||||||
return compile(pattern, _fixflags(flags)).search(string)
|
return compile(pattern, _fixflags(flags)).search(string)
|
||||||
|
|
||||||
# FIXME: etc
|
# FIXME: etc
|
||||||
|
@ -41,6 +40,6 @@ def search(pattern, string, flags=0):
|
||||||
|
|
||||||
def _fixflags(flags):
|
def _fixflags(flags):
|
||||||
# convert flag bitmask to sequence
|
# convert flag bitmask to sequence
|
||||||
assert flags == 0
|
assert not flags
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue