mirror of
https://github.com/python/cpython.git
synced 2025-09-17 06:06:25 +00:00
Fix issue 1661: Flags argument silently ignored in re functions with compiled regexes.
This commit is contained in:
parent
0f5e7bf304
commit
80016c9555
2 changed files with 10 additions and 0 deletions
|
@ -224,6 +224,8 @@ def _compile(*key):
|
|||
return p
|
||||
pattern, flags = key
|
||||
if isinstance(pattern, _pattern_type):
|
||||
if flags:
|
||||
raise ValueError('Cannot process flags argument with a compiled pattern')
|
||||
return pattern
|
||||
if not sre_compile.isstring(pattern):
|
||||
raise TypeError, "first argument must be string or compiled pattern"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue