[Python-Dev] Exception masking/chaining

Steven Taschuk staschuk@telusplanet.net
Thu, 12 Jun 2003 11:36:24 -0600


Quoth Guido van Rossum:
> > As an aside, is it planned that sys.exc_traceback,type and value
> > will start emitting DeprecationWarnings any time soon? [...]
> 
> It's hard to put a deprecation warning on these, because they're just
> module attributes.

This came up a day or two ago in c.l.py too.  Bernhard Herzog
suggested:

    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.  [1]

Seems feasible; but also seems to incur a cost for every attribute
lookup in sys, and might be a bad precedent for fancy attribute
access for modules.

[1]
<http://groups.google.com/groups?selm=6qn0gp23kr.fsf%40salmakis.intevation.de>

-- 
Steven Taschuk              Aral: "Confusion to the enemy, boy."
staschuk@telusplanet.net    Mark: "Turn-about is fair play, sir."
                             -- _Mirror Dance_, Lois McMaster Bujold