This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: asyncio: enable debug mode when -X dev is used
Type: Stage: resolved
Components: asyncio Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2017-11-16 11:50 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit vstinner, 2017-11-16 11:50
Pull Requests
URL Status Linked Edit
PR 4418 merged vstinner, 2017-11-16 11:51
Messages (3)
msg306353 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-16 11:50
The bpo-32043 added a new "developer mode" enabled with the new -X dev command line option.

I propose to enable asyncio debug mode with the global Python "developer mode".

If an asyncio application is correctly written, the single side effect of -X dev would be to log "Executing ... took ... seconds" if a handle took longer than 100 ms. Well, a handle should *not* take longer than 100 ms. So maybe it's ok to start logging such events in the "developer mode", no?

Example with attached script which blocks the event loop.

(1) This command doesn't display anything:

haypo@selma$ ./python 

(2) In developer mode, the warning a emitted to warn the developer about the bug:

$ ./python -X dev 
Executing <Task finished coro=<block_loop() done, defined at> result=None created at /home/haypo/prog/python/master/Lib/asyncio/> took 1.002 seconds
msg306360 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-16 14:01
I sent an email about this change to python-dev:
msg306552 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-20 15:14
New changeset 44862df2eeec62adea20672b0fe2a5d3e160569e by Victor Stinner in branch 'master':
bpo-32047: -X dev enables asyncio debug mode (#4418)
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76228
2017-11-20 15:14:29vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-11-20 15:14:09vstinnersetmessages: + msg306552
2017-11-16 14:01:28vstinnersetmessages: + msg306360
2017-11-16 11:51:37vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request4367
2017-11-16 11:50:52vstinnercreate