Skip to content

uasyncio emits no error message if a coro is called rather than awaited. #3241

Description

@peterhinch

The following

import uasyncio as asyncio

async def bar():
    await asyncio.sleep(1)
    print('In bar')

async def foo():
    print('Launching bar')
    await bar()
    print('Getting it wrong')
    bar()  # bad

loop = asyncio.get_event_loop()
loop.run_until_complete(foo())

produces this output

>>> import rats37
Launching bar
In bar
Getting it wrong
>>> 

CPython 3.5.2 issues the following error message:

>>> import rats37
Launching bar
In bar
Getting it wrong
/home/adminpete/rats37.py:11: RuntimeWarning: coroutine 'bar' was never awaited
  bar()
>>> 

It would be useful if a message were emitted in response to this error.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extmodRelates to extmod/ directory in source

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions