mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-32670: Enforce PEP 479. (#5327)
This commit is contained in:
parent
dba976b8a2
commit
43c47fe096
7 changed files with 38 additions and 80 deletions
|
@ -367,17 +367,21 @@ The following exceptions are the exceptions that are usually raised.
|
|||
raised, and the value returned by the function is used as the
|
||||
:attr:`value` parameter to the constructor of the exception.
|
||||
|
||||
If a generator function defined in the presence of a ``from __future__
|
||||
import generator_stop`` directive raises :exc:`StopIteration`, it will be
|
||||
converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration`
|
||||
as the new exception's cause).
|
||||
If a generator code directly or indirectly raises :exc:`StopIteration`,
|
||||
it is converted into a :exc:`RuntimeError` (retaining the
|
||||
:exc:`StopIteration` as the new exception's cause).
|
||||
|
||||
.. versionchanged:: 3.3
|
||||
Added ``value`` attribute and the ability for generator functions to
|
||||
use it to return a value.
|
||||
|
||||
.. versionchanged:: 3.5
|
||||
Introduced the RuntimeError transformation.
|
||||
Introduced the RuntimeError transformation via
|
||||
``from __future__ import generator_stop``, see :pep:`479`.
|
||||
|
||||
.. versionchanged:: 3.7
|
||||
Enable :pep:`479` for all code by default: a :exc:`StopIteration`
|
||||
error raised in a generator is transformed into a :exc:`RuntimeError`.
|
||||
|
||||
.. exception:: StopAsyncIteration
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue