diff options
author | Yury Selivanov <yury@magic.io> | 2016-12-15 17:36:37 -0500 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-12-15 17:36:37 -0500 |
commit | 71630bab6a7243c2f21cb060cbf864c905b5a441 (patch) | |
tree | cb98c60ea3df5437e4e135afe564e2402572997e /Doc/library/sys.rst | |
parent | 31eaf49ed93e725ba84e17156b90c785ca8ecb4c (diff) | |
parent | 03660041d2d3a95e7bc4ad863278bd93e28c805e (diff) | |
download | cpython-git-71630bab6a7243c2f21cb060cbf864c905b5a441.tar.gz |
Merge 3.6 (issue #28091)
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r-- | Doc/library/sys.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index f8ef83a45d..54b99e0fd9 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -603,6 +603,24 @@ always available. .. versionchanged:: 3.6 Added *platform_version* + +.. function:: get_asyncgen_hooks() + + Returns an *asyncgen_hooks* object, which is similar to a + :class:`~collections.namedtuple` of the form `(firstiter, finalizer)`, + where *firstiter* and *finalizer* are expected to be either ``None`` or + functions which take an :term:`asynchronous generator iterator` as an + argument, and are used to schedule finalization of an asychronous + generator by an event loop. + + .. versionadded:: 3.6 + See :pep:`525` for more details. + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + + .. function:: get_coroutine_wrapper() Returns ``None``, or a wrapper set by :func:`set_coroutine_wrapper`. @@ -1107,6 +1125,24 @@ always available. implementation platform, rather than part of the language definition, and thus may not be available in all Python implementations. +.. function:: set_asyncgen_hooks(firstiter, finalizer) + + Accepts two optional keyword arguments which are callables that accept an + :term:`asynchronous generator iterator` as an argument. The *firstiter* + callable will be called when an asynchronous generator is iterated for the + first time. The *finalizer* will be called when an asynchronous generator + is about to be garbage collected. + + .. versionadded:: 3.6 + See :pep:`525` for more details, and for a reference example of a + *finalizer* method see the implementation of + ``asyncio.Loop.shutdown_asyncgens`` in + :source:`Lib/asyncio/base_events.py` + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + .. function:: set_coroutine_wrapper(wrapper) |