A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-June/036218.html below:

[Python-Dev] Exception masking/chaining

[Python-Dev] Exception masking/chainingWalter Dörwald walter@livinglogic.de
Thu, 12 Jun 2003 12:44:19 +0200
Greg Ewing wrote:

> Guido:
> 
>>More globals of course defeat the purpose (one of the reasons for
>>putting the traceback in the exception is to get rid of
>>sys.exc_traceback).
> 
> I think the idea was that this would be a C-level global,
> not a Python one (i.e. part of the existing group of
> C variables representing the current exception state).

Exactly. We'd only need this as sys.exc_cause, if we implemented
exception chaining before moving the traceback into the exception.

So maybe the plan should look somethink like this:

1. Deprecate string exceptions.

2. Make Exception a new-style class.

3. Require exceptions to be derived from Exception.

4. Make the traceback an attribute of the exception object.

5. Implement exception chaining (as an attribute named cause on
    the outer exception referencing the inner exception).

6. Add other exception attributes (e.g. KeyError has an attribute
    key, IndexError has an attribute index, IOError has attributes
    filename, errorcode etc.)

Is there anything else that should go into the new exception PEP?
(No, I'm not volunteering to write it. ;) Maybe it should be split
into multiple PEPs?)

> [...]

Bye,
    Walter Dörwald





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4