Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio: enable debug mode when -X dev is used #76228

Closed
vstinner opened this issue Nov 16, 2017 · 3 comments
Closed

asyncio: enable debug mode when -X dev is used #76228

vstinner opened this issue Nov 16, 2017 · 3 comments
Labels

Comments

@vstinner
Copy link
Member

BPO 32047
Nosy @vstinner, @1st1
PRs
  • bpo-32047: -X dev enables asyncio debug mode #4418
  • Files
  • block_loop.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-11-20.15:14:29.505>
    created_at = <Date 2017-11-16.11:50:52.830>
    labels = ['3.7', 'expert-asyncio']
    title = 'asyncio: enable debug mode when -X dev is used'
    updated_at = <Date 2017-11-20.15:14:29.504>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-11-20.15:14:29.504>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-20.15:14:29.505>
    closer = 'vstinner'
    components = ['asyncio']
    creation = <Date 2017-11-16.11:50:52.830>
    creator = 'vstinner'
    dependencies = []
    files = ['47269']
    hgrepos = []
    issue_num = 32047
    keywords = ['patch']
    message_count = 3.0
    messages = ['306353', '306360', '306552']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'yselivanov']
    pr_nums = ['4418']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32047'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    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 block_loop.py script which blocks the event loop.

    (1) This command doesn't display anything:

    haypo@selma$ ./python block_loop.py

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

    $ ./python -X dev block_loop.py 
    Executing <Task finished coro=<block_loop() done, defined at block_loop.py:4> result=None created at /home/haypo/prog/python/master/Lib/asyncio/base_events.py:444> took 1.002 seconds

    @vstinner
    Copy link
    Member Author

    I sent an email about this change to python-dev: https://mail.python.org/pipermail/python-dev/2017-November/150572.html

    @vstinner
    Copy link
    Member Author

    New changeset 44862df by Victor Stinner in branch 'master':
    bpo-32047: -X dev enables asyncio debug mode (bpo-4418)
    44862df

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant