*** pep-0344.txt.orig --- pep-0344.txt *************** *** 339,345 **** library contains no mention of such attributes. ! Open Issues Walter Dörwald [11] expressed a desire to attach extra information to an exception during its upward propagation without changing its --- 339,345 ---- library contains no mention of such attributes. ! Open Issue: Extra Information Walter Dörwald [11] expressed a desire to attach extra information to an exception during its upward propagation without changing its *************** *** 348,356 **** --- 348,362 ---- establishing conventions for other informational attributes on exceptions. + + Open Issue: Suppressing Context + As written, this PEP makes it impossible to suppress '__context__', since setting exc.__context__ to None in an 'except' or 'finally' clause will only result in it being set again when exc is raised. + + + Open Issue: Limiting Exception Types To improve encapsulation, library implementors may want to wrap all implementation-level exceptions with an application-level exception. *************** *** 377,382 **** --- 383,391 ---- ... implementation may raise an exception ... except *, exc: raise ApplicationError from exc + + + Open Issue: yield The exception context is lost when a 'yield' statement is executed; resuming the frame after the 'yield' does not restore the context. *************** *** 398,403 **** --- 407,437 ---- (deprecated), not NoneType + Open Issue: Garbage Collection + + The strongest objection to this proposal has been that it creates + cycles between Exceptions and stack frames. Collection of cyclic + garbage (and therefore resource release) can be greatly delayed. + + >>> try: + >>> 1/0 + >>> except Exception, err: + >>> pass + + will introduce a cycle from err -> traceback -> stack frame -> err, + keeping all locals in the same scope alive until the next GC happens. + + Today, these locals would go out of scope. There is lots of code + which assumes that "local" resources -- particularly open files -- will + be closed quickly. If closure has to wait for the next GC, a program + (which runs fine today) may run out of file handles. + + Making the __traceback__ attribute a weak reference would avoid the + problems with cyclic garbage. Unfortunately, it would make saving + the Exception for later (as unittest does) more awkward, and it would + not allow as much cleanup of the sys module. + + Possible Future Compatible Changes These changes are consistent with the appearance of exceptions as *************** *** 477,482 **** --- 511,519 ---- [11] Walter Dörwald suggests wrapping exceptions to add details http://mail.python.org/pipermail/python-dev/2003-June/036148.html + + [12] Guido van Rossum restates the objection to cyclic trash + http://mail.python.org/pipermail/python-3000/2007-January/005322.html Copyright