Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RuntimeWarning "coroutine was never awaited" prints first line of file called sys #117535

Closed
@hroncok

Description

@hroncok

Bug report

Bug description:

async def coroutine():
    pass

coroutine().nope
$ echo 'Why would you print me?' > sys

$ python3.12 nowait.py 
Traceback (most recent call last):
  File ".../nowait.py", line 4, in <module>
    coroutine().nope
AttributeError: 'coroutine' object has no attribute 'nope'
sys:1: RuntimeWarning: coroutine 'coroutine' was never awaited
  Why would you print me?

Note the last line of the error. It is from the sys file.

This does not go away when Python is invoked with -P, -E, or -I.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions