[Python-checkins] peps: pep-0492: Fix differences from what was committed.

yury.selivanov python-checkins at python.org
Tue May 12 05:47:15 CEST 2015


https://hg.python.org/peps/rev/35254e20f2f8
changeset:   5842:35254e20f2f8
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Mon May 11 23:47:11 2015 -0400
summary:
  pep-0492: Fix differences from what was committed.

files:
  pep-0492.txt |  48 ++++++++++++++++++++--------------------
  1 files changed, 24 insertions(+), 24 deletions(-)


diff --git a/pep-0492.txt b/pep-0492.txt
--- a/pep-0492.txt
+++ b/pep-0492.txt
@@ -110,14 +110,14 @@
 
 * Internally, two new code object flags were introduced:
 
-  - ``CO_COROUTINE`` is used to enable runtime detection of
-    *coroutines* (and migrating existing code).
-
-  - ``CO_NATIVE_COROUTINE`` is used to mark *native coroutines*
+  - ``CO_COROUTINE`` is used to mark *native coroutines*
     (defined with new syntax.)
 
-  All coroutines have ``CO_COROUTINE``, ``CO_NATIVE_COROUTINE``, and
-  ``CO_GENERATOR`` flags set.
+  - ``CO_ITERABLE_COROUTINE`` is used to make *generator-based
+    coroutines* compatible with *native coroutines* (set by
+    `types.coroutine()`_ function).
+
+  All coroutines have ``CO_GENERATOR`` flag set.
 
 * Regular generators, when called, return a *generator object*;
   similarly, coroutines return a *coroutine* object.
@@ -139,13 +139,13 @@
 allows interoperability between existing *generator-based coroutines*
 in asyncio and *native coroutines* introduced by this PEP.
 
-The function applies ``CO_COROUTINE`` flag to generator-function's code
-object, making it return a *coroutine* object.
+The function applies ``CO_ITERABLE_COROUTINE`` flag to generator-
+function's code object, making it return a *coroutine* object.
 
 The function can be used as a decorator, since it modifies generator-
 functions in-place and returns them.
 
-Note, that the ``CO_NATIVE_COROUTINE`` flag is not applied by
+Note, that the ``CO_COROUTINE`` flag is not applied by
 ``types.coroutine()`` to make it possible to separate *native
 coroutines* defined with new syntax, from *generator-based coroutines*.
 
@@ -199,8 +199,8 @@
   It is a ``TypeError`` if ``__await__`` returns anything but an
   iterator.
 
-* Objects defined with CPython C API with a ``tp_await`` function,
-  returning an iterator (similar to ``__await__`` method).
+* Objects defined with CPython C API with a ``tp_as_async->am_await``
+  function, returning an *iterator* (similar to ``__await__`` method).
 
 It is a ``SyntaxError`` to use ``await`` outside of an ``async def``
 function (like it is a ``SyntaxError`` to use ``yield`` outside of
@@ -589,9 +589,8 @@
 Differences from generators
 '''''''''''''''''''''''''''
 
-This section applies only to *native coroutines* with
-``CO_NATIVE_COROUTINE`` flag, i.e. defined with the new ``async def``
-syntax.
+This section applies only to *native coroutines* with ``CO_COROUTINE``
+flag, i.e. defined with the new ``async def`` syntax.
 
 **The behavior of existing *generator-based coroutines* in asyncio
 remains unchanged.**
@@ -725,11 +724,11 @@
 
 :Future-like object:
     An object with an ``__await__`` method, or a C object with
-    ``tp_await`` function, returning an iterator.  Can be consumed by
-    an ``await`` expression in a coroutine. A coroutine waiting for a
-    Future-like object is suspended until the Future-like object's
-    ``__await__`` completes, and returns the result.  See `Await
-    Expression`_ for details.
+    ``tp_as_async->am_await`` function, returning an *iterator*.  Can be
+    consumed by an ``await`` expression in a coroutine. A coroutine
+    waiting for a Future-like object is suspended until the Future-like
+    object's ``__await__`` completes, and returns the result.  See
+    `Await Expression`_ for details.
 
 :Awaitable:
     A *Future-like* object or a *coroutine* object.  See `Await
@@ -1294,14 +1293,15 @@
    keyword.
 
 2. New ``__await__`` method for Future-like objects, and new
-   ``tp_await`` slot in ``PyTypeObject``.
+   ``tp_as_async->am_await`` slot in ``PyTypeObject``.
 
 3. New syntax for asynchronous context managers: ``async with``.  And
    associated protocol with ``__aenter__`` and ``__aexit__`` methods.
 
 4. New syntax for asynchronous iteration: ``async for``.  And
    associated protocol with ``__aiter__``, ``__aexit__`` and new built-
-   in exception ``StopAsyncIteration``.
+   in exception ``StopAsyncIteration``.  New ``tp_as_async->am_aiter``
+   and ``tp_as_async->am_anext`` slots in ``PyTypeObject``.
 
 5. New AST nodes: ``AsyncFunctionDef``, ``AsyncFor``, ``AsyncWith``,
    ``Await``.
@@ -1311,7 +1311,7 @@
    ``inspect.iscoroutinefunction()``, ``inspect.iscoroutine()``,
    and ``inspect.isawaitable()``.
 
-7. New ``CO_COROUTINE`` and ``CO_NATIVE_COROUTINE`` bit flags for code
+7. New ``CO_COROUTINE`` and ``CO_ITERABLE_COROUTINE`` bit flags for code
    objects.
 
 While the list of changes and new things is not short, it is important
@@ -1408,8 +1408,8 @@
 Svetlov, Łukasz Langa, Greg Ewing, Stephen J. Turnbull, Jim J. Jewett,
 Brett Cannon, Nick Coghlan, Steven D'Aprano, Paul Moore, Nathaniel
 Smith, Ethan Furman, Stefan Behnel, Paul Sokolovsky, Victor Petrovykh,
-and many others for their feedback, ideas, edits, criticism, and
-discussions around this PEP.
+and many others for their feedback, ideas, edits, criticism, code
+reviews, and discussions around this PEP.
 
 
 Copyright

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list