[Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)

Collin Winter collinw at gmail.com
Sat Feb 10 02:27:14 CET 2007


On 2/9/07, Guido van Rossum <guido at python.org> wrote:
> On 2/9/07, Collin Winter <collinw at gmail.com> wrote:
> > sys.exc_info() will be kept, while the sys.exc_{type,value,traceback}
> > attributes will be dropped.
>
> I understand why, but that doesn't make me comfortable with keeping
> it. Maybe in "3.0 compatibility mode" 2.6 could attach tracebacks to
> exception objects so we could be weened off it in 2.6?

That would imply that 2.6's "3.0 compatibility mode" would also
activate the cleanup semantics for "except" clauses. Switching that
kind of deep, subtle functionality on or off based on a command-line
switch makes me uncomfortable. There would also have to be a way of
distinguishing .pyc files produced by 2.6 versus those produced by 2.6
in 3.0-mode (since the cleanup semantics are implemented by emitting
extra bytecode for the implicit inner try/finally block).

> > As an aside, should sys.exc_clear() be added to the to-drop list? Is
> > there still a need for it given Python 3's exception cleanup
> > semantics?
>
> I don't think so -- AFAIK the same use case is handled well enough by
> the cleanup semantics of the except clause.

I've added sys.exc_clear()'s demise to PEP 3100.

Collin Winter


More information about the Python-3000 mailing list