[Python-bugs-list] [ python-Bugs-425261 ] re propagates opaque exceptions

noreply@sourceforge.net noreply@sourceforge.net
Fri, 18 May 2001 13:12:55 -0700


Bugs item #425261, was updated on 2001-05-18 10:53
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=425261&group_id=5470

Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Fredrik Lundh (effbot)
Summary: re propagates opaque exceptions

Initial Comment:
If you call re.compile() with an erroneous expression,
the
underlying extension module (pcre, sre, ...?) raises an
exception which is propagated through re to the caller.

In order to catch the exception, it seems that you need
to
use an unqualified except clause, unless you import the
extension module, which is presumably supposed to be
opaque (particularly if its identity is variable!)

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-05-18 13:12

Message:
Logged In: YES 
user_id=31435

Assigned to /F.  Would probably be better if, e.g., 
sre_constants.error were a subclass of, say, SyntaxError?


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=425261&group_id=5470