[Python-Dev] Exception masking/chaining

Bernhard Herzog bh@intevation.de
12 Jun 2003 20:07:07 +0200


Guido van Rossum <guido@python.org> writes:

> >     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,

Only for those that are implemented as properties, I think.

> > and might be a bad precedent for fancy attribute
> > access for modules.

Well, some of us would actually like to have this sometimes :)

[...]
> The big problem is that it would require a major rewrite of the sys
> module, wouldn't it?

It would also mean that type(sys) is no longer ModuleType, right? There
is some code in the standard library that relies on this, even a few
test cases. The library could easily be fixed, but chances are others
also rely on this.

   Bernhard

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