summaryrefslogtreecommitdiff
path: root/Lib/re.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-12-19 18:13:31 +0000
committerRaymond Hettinger <python@rcn.com>2007-12-19 18:13:31 +0000
commit80016c95554677cd172610501446b096edfb267c (patch)
tree114f9f7ea92a5a63e2b1d40b30354f1962558ea4 /Lib/re.py
parent0f5e7bf3049408d6f4c1855807204c9f13ae98f9 (diff)
downloadcpython-git-80016c95554677cd172610501446b096edfb267c.tar.gz
Fix issue 1661: Flags argument silently ignored in re functions with compiled regexes.
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 a33e34e4e1..39e81fdf4f 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"