@@ -563,10 +563,10 @@ The :keyword:`!raise` statement
563563.. productionlist :: python-grammar
564564 raise_stmt: "raise" [`expression ` ["from" `expression `]]
565565
566- If no expressions are present, :keyword: `raise ` re-raises the last exception
567- that was active in the current scope. If no exception is active in the current
568- scope , a :exc: `RuntimeError ` exception is raised indicating that this is an
569- error.
566+ If no expressions are present, :keyword: `raise ` re-raises the
567+ exception that is currently being handled, which is also known as the * active exception *.
568+ If there isn't currently an active exception , a :exc: `RuntimeError ` exception is raised
569+ indicating that this is an error.
570570
571571Otherwise, :keyword: `raise ` evaluates the first expression as the exception
572572object. It must be either a subclass or an instance of :class: `BaseException `.
@@ -581,8 +581,8 @@ The :dfn:`type` of the exception is the exception instance's class, the
581581A traceback object is normally created automatically when an exception is raised
582582and attached to it as the :attr: `__traceback__ ` attribute, which is writable.
583583You can create an exception and set your own traceback in one step using the
584- :meth: `with_traceback ` exception method (which returns the same exception
585- instance, with its traceback set to its argument), like so::
584+ :meth: `~BaseException. with_traceback ` exception method (which returns the
585+ same exception instance, with its traceback set to its argument), like so::
586586
587587 raise Exception("foo occurred").with_traceback(tracebackobj)
588588
@@ -614,8 +614,10 @@ exceptions will be printed::
614614 File "<stdin>", line 4, in <module>
615615 RuntimeError: Something bad happened
616616
617- A similar mechanism works implicitly if an exception is raised inside an
618- exception handler or a :keyword: `finally ` clause: the previous exception is then
617+ A similar mechanism works implicitly if a new exception is raised when
618+ an exception is already being handled. An exception may be handled
619+ when an :keyword: `except ` or :keyword: `finally ` clause, or a
620+ :keyword: `with ` statement, is used. The previous exception is then
619621attached as the new exception's :attr: `__context__ ` attribute::
620622
621623 >>> try:
0 commit comments