diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-19 22:15:02 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-19 22:15:02 (GMT) |
commit | 7ef60cd8c208d22672e76fcf031b4fa671a13684 (patch) | |
tree | 450d12c31c3fe734566c85bcc0d04c4301a37836 /Doc | |
parent | f4558e8b54da0a7caf800c80589d934186b16f79 (diff) | |
download | cpython-7ef60cd8c208d22672e76fcf031b4fa671a13684.zip cpython-7ef60cd8c208d22672e76fcf031b4fa671a13684.tar.gz cpython-7ef60cd8c208d22672e76fcf031b4fa671a13684.tar.bz2 |
asyncio, Tulip issue #136: Add get/set_debug() methods to BaseEventLoopTests.
Add also a PYTHONASYNCIODEBUG environment variable to debug coroutines since
Python startup, to be able to debug coroutines defined directly in the asyncio
module.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-dev.rst | 10 | ||||
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 16 | ||||
-rw-r--r-- | Doc/using/cmdline.rst | 8 |
3 files changed, 30 insertions, 4 deletions
diff --git a/Doc/library/asyncio-dev.rst b/Doc/library/asyncio-dev.rst index 90bae84..c5f0d1a 100644 --- a/Doc/library/asyncio-dev.rst +++ b/Doc/library/asyncio-dev.rst @@ -1,5 +1,7 @@ .. currentmodule:: asyncio +.. _asyncio-dev: + Develop with asyncio ==================== @@ -81,10 +83,10 @@ Detect coroutine objects never scheduled When a coroutine function is called but not passed to :func:`async` or to the :class:`Task` constructor, it is not scheduled and it is probably a bug. -To detect such bug, set :data:`asyncio.tasks._DEBUG` to ``True``. When the -coroutine object is destroyed by the garbage collector, a log will be emitted -with the traceback where the coroutine function was called. See the -:ref:`asyncio logger <asyncio-logger>`. +To detect such bug, set the environment variable :envvar:`PYTHONASYNCIODEBUG` +to ``1``. When the coroutine object is destroyed by the garbage collector, a +log will be emitted with the traceback where the coroutine function was called. +See the :ref:`asyncio logger <asyncio-logger>`. The debug flag changes the behaviour of the :func:`coroutine` decorator. The debug flag value is only used when then coroutine function is defined, not when diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index f056cac..04b182b 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -553,6 +553,22 @@ pool of processes). By default, an event loop uses a thread pool executor Set the default executor used by :meth:`run_in_executor`. +Debug mode +---------- + +.. method:: BaseEventLoop.get_debug() + + Get the debug mode (:class:`bool`) of the event loop. + +.. method:: BaseEventLoop.set_debug(enabled: bool) + + Set the debug mode of the event loop. + +.. seealso:: + + The :ref:`Develop with asyncio <asyncio-dev>` section. + + Server ------ diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 4807a36..0c3c203 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -614,6 +614,14 @@ conflict. .. versionadded:: 3.4 +.. envvar:: PYTHONASYNCIODEBUG + + If this environment variable is set to a non-empty string, enable the debug + mode of the :mod:`asyncio` module. + + .. versionadded:: 3.4 + + Debug-mode variables ~~~~~~~~~~~~~~~~~~~~ |