summaryrefslogtreecommitdiffstats
path: root/Lib/re.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 (GMT)
commitce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch)
tree05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/re.py
parent8b3febef2f96c35e9aad9db2ef499db040fdefae (diff)
downloadcpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip
cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz
cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/re.py b/Lib/re.py
index 534ab23..4c5622b 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -226,11 +226,8 @@ def _compile(*key):
if isinstance(pattern, _pattern_type):
return pattern
if not sre_compile.isstring(pattern):
- raise TypeError, "first argument must be string or compiled pattern"
- try:
- p = sre_compile.compile(pattern, flags)
- except error as v:
- raise error, v # invalid expression
+ raise TypeError("first argument must be string or compiled pattern")
+ p = sre_compile.compile(pattern, flags)
if len(_cache) >= _MAXCACHE:
_cache.clear()
_cache[cachekey] = p
@@ -242,10 +239,7 @@ def _compile_repl(*key):
if p is not None:
return p
repl, pattern = key
- try:
- p = sre_parse.parse_template(repl, pattern)
- except error as v:
- raise error, v # invalid expression
+ p = sre_parse.parse_template(repl, pattern)
if len(_cache_repl) >= _MAXCACHE:
_cache_repl.clear()
_cache_repl[key] = p