diff -r 0e438442fddf Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst Mon Feb 18 21:39:18 2013 -0500 +++ b/Doc/reference/simple_stmts.rst Sat Feb 23 20:20:43 2013 +0100 @@ -555,6 +555,29 @@ File "", line 4, in RuntimeError: Something bad happened + +.. versionchanged:: 3.3 + :const:`None` is now permitted as ``Y`` in ``raise X from Y`` + +.. versionadded:: 3.3 + The ``__supress_context__`` attribute to suppress automatic display of the + exception context + +The :const:`from None` clause can be used to suppress the old exception with +the new one for display purposes. This will set the +:attr:`__suppress_context__` attribute to :const:`True` while leaving the old +exception available in :attr:`__context__` for introspection when debugging:: + + >>> try: + ... print(1 / 0) + ... except: + ... raise RuntimeError("Something bad happened") from None + ... + Traceback (most recent call last): + File "", line 4, in + RuntimeError: Something bad happened + + A similar mechanism works implicitly if an exception is raised inside an exception handler: the previous exception is then attached as the new exception's :attr:`__context__` attribute::