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

Make not yielding from or awaiting a coroutine a SyntaxError #71714

Closed
AraHaan mannequin opened this issue Jul 16, 2016 · 6 comments
Closed

Make not yielding from or awaiting a coroutine a SyntaxError #71714

AraHaan mannequin opened this issue Jul 16, 2016 · 6 comments
Labels
OS-windows type-feature A feature request or enhancement

Comments

@AraHaan
Copy link
Mannequin

AraHaan mannequin commented Jul 16, 2016

BPO 27527
Nosy @pfmoore, @tjguk, @bitdancer, @zware, @zooba, @AraHaan

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 2016-07-16.12:45:34.616>
created_at = <Date 2016-07-16.05:16:03.789>
labels = ['type-feature', 'OS-windows']
title = 'Make not yielding from or awaiting a coroutine a SyntaxError'
updated_at = <Date 2016-07-16.12:48:08.162>
user = 'https://github.com/AraHaan'

bugs.python.org fields:

activity = <Date 2016-07-16.12:48:08.162>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2016-07-16.12:45:34.616>
closer = 'r.david.murray'
components = ['Windows']
creation = <Date 2016-07-16.05:16:03.789>
creator = 'Decorater'
dependencies = []
files = []
hgrepos = []
issue_num = 27527
keywords = []
message_count = 6.0
messages = ['270538', '270539', '270540', '270541', '270557', '270558']
nosy_count = 6.0
nosy_names = ['paul.moore', 'tim.golden', 'r.david.murray', 'zach.ware', 'steve.dower', 'Decorater']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue27527'
versions = ['Python 3.5', 'Python 3.6']

@AraHaan
Copy link
Mannequin Author

AraHaan mannequin commented Jul 16, 2016

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.

@AraHaan AraHaan mannequin added the OS-windows label Jul 16, 2016
@AraHaan
Copy link
Mannequin Author

AraHaan mannequin commented Jul 16, 2016

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.

@AraHaan AraHaan mannequin added the type-feature A feature request or enhancement label Jul 16, 2016
@AraHaan
Copy link
Mannequin Author

AraHaan mannequin commented Jul 16, 2016

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.

@AraHaan
Copy link
Mannequin Author

AraHaan mannequin commented Jul 16, 2016

So to make it Error it must be :

import asyncio

async def SomeCoroutine():
    print("test...")

SomeCoroutine()

@bitdancer
Copy link
Member

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.

@bitdancer
Copy link
Member

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.

@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
OS-windows type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant