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
Make not yielding from or awaiting a coroutine a SyntaxError #71714
Comments
Currently there is a waring printed in python when you try to call a coroutine without yieling from or awaiting it but I would like it to be a SyntaxError when this happens instead. |
I am thinking like this example: import asyncio
@asyncio.coroutine
def SomeCoroutine():
print("test...")
@asyncio.coroutine
def SomeNormalFunction():
SomeCoroutine() Will print a warning instead I would like it to be a SyntaxError when the function is called that tries to call a coroutine that has not been yielded/awaited at all. |
Oh it does not happen if you use the asyncio.coroutine decorater but it does do RuntimeWarning if you use the async def on it. |
So to make it Error it must be : import asyncio
async def SomeCoroutine():
print("test...")
SomeCoroutine() |
It can't be a syntax error. There are legitimate reasons for calling a coroutine and then passing around the resulting object before awaiting it. |
Also, fyi it was couterproductive to code this as a Windows issue...that alerted the windows experts, but it is not a windows-specific issue, so it just pinged them needlessly. Also FYI, enahancements can only go into the next feature release, so the correct versions selection would have been 3.6 only. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: