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

SystemExit out of run_until_complete causes AttributeError when using python3 -m #66670

Closed
chrysn mannequin opened this issue Sep 24, 2014 · 3 comments
Closed

SystemExit out of run_until_complete causes AttributeError when using python3 -m #66670

chrysn mannequin opened this issue Sep 24, 2014 · 3 comments

Comments

@chrysn
Copy link
Mannequin

chrysn mannequin commented Sep 24, 2014

BPO 22480
Nosy @gvanrossum, @vstinner, @chrysn, @1st1
Superseder
  • bpo-22428: asyncio: KeyboardInterrupt inside a coroutine causes AttributeError
  • Files
  • test.py
  • test.err
  • destructortest.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 2014-10-11.12:38:29.571>
    created_at = <Date 2014-09-24.11:22:12.229>
    labels = ['expert-asyncio']
    title = 'SystemExit out of run_until_complete causes AttributeError when using python3 -m'
    updated_at = <Date 2014-10-11.12:38:29.570>
    user = 'https://github.com/chrysn'

    bugs.python.org fields:

    activity = <Date 2014-10-11.12:38:29.570>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-10-11.12:38:29.571>
    closer = 'vstinner'
    components = ['asyncio']
    creation = <Date 2014-09-24.11:22:12.229>
    creator = 'chrysn'
    dependencies = []
    files = ['36707', '36708', '36709']
    hgrepos = []
    issue_num = 22480
    keywords = []
    message_count = 3.0
    messages = ['227440', '227457', '228988']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'vstinner', 'chrysn', 'yselivanov']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '22428'
    type = None
    url = 'https://bugs.python.org/issue22480'
    versions = ['Python 3.4', 'Python 3.5']

    @chrysn
    Copy link
    Mannequin Author

    chrysn mannequin commented Sep 24, 2014

    the attached test.py snipplet, which runs an asyncio main loop to the completion of a coroutine raising SystemExit, runs cleanly when invoked using python3 test.py, but shows a logging error from the Task.del method when invoked using python3 -m test.

    the error message (attached as test.err) indicates that the builtins module has already been emptied by the time the Task's destructor is run.

    i could reproduce the problem with an easier test case without asyncio (destructoretest.py), but then again, there the issue is slightly more obvious (one could argue a "don't do that, then"), and it occurs no matter how the program is run. i'm leaving this initially assigned to asyncio, because (to the best of my knowledge) test.py does not do bad things by itself, and the behavior is inconsistent only there.

    @chrysn chrysn mannequin added the topic-asyncio label Sep 24, 2014
    @vstinner
    Copy link
    Member

    Running "python test.py" and "python -m test" changes how the code is loaded. With "python test.py", test.py becomes the "__main__" module, whereas "python -m test" uses the "test" module.

    At Python exit, the __main__ module and other modules are destroyed differently.

    Anyway, this issue is another example of the issue bpo-22428 and so I close it as duplicate.

    @vstinner
    Copy link
    Member

    I created a more specific issue for destructortest.py: issue bpo-22599. It's not directly related to asyncio.

    @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
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant