diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
commit | ce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch) | |
tree | 05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/re.py | |
parent | 8b3febef2f96c35e9aad9db2ef499db040fdefae (diff) | |
download | cpython-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.py | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -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 |