PEP 317: Eliminate Implicit Exception Instantiation

Bernhard Herzog bh at intevation.de
Tue Jun 10 20:24:36 CEST 2003


Steven Taschuk <staschuk at telusplanet.net> writes:

> Quoth Bernhard Herzog:
>   [...]
> > Yes, but Python doesn't issue warnings about it. Actually, issuing
> > deprecation warnings for exc_traceback and friends might be a good idea.
> > The alternative has been available since 1.5 and it is a potential
> > source of bugs. It would be far less controversial than the proposed
> > syntax change for the raise statement, I think.
> 
> I agree entirely, but I don't see how such warnings could be
> implemented.  How can you hook into access of specific globals?

exc_* are not globals, they're attributes of the sys module.

What you could do, I think, is turn sys into an instance of a subclass
of module and make exc_traceback and friends properties in that new
subclass whose get functions simply return the appropriate value from
sys.exc_info(). That would actually solve the bug wrt. threading and the
get function could also issue a warning.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/




More information about the Python-list mailing list