summaryrefslogtreecommitdiff
path: root/Lib/re.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/re.py b/Lib/re.py
index 4c5622b968..1e0c468795 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -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")