This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Tadhg McDonald-Jensen
Recipients Tadhg McDonald-Jensen, r.david.murray, yselivanov
Date 2017-03-27.19:53:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490644416.45.0.400333071932.issue29922@psf.upfronthosting.co.za>
In-reply-to
Content
> This is a specific example of the general problem reported in issue 25538.

Definitely related, although the part of giving an error "... can't be used in 'await' expression" when no await expression is used isn't covered by that thread so I'm not sure I'd call this a direct duplicate.


Currently when __anext__ return a non-awaitable this error is shown:

TypeError: 'async for' received an invalid object from __anext__: NoneType

So having __aenter__ and __aexit__ have similar error messages would be nice.

Would it maybe make sense to implement this as adding an argument to GET_AWAITABLE to indicate whether it was called from await, __anext__, __aenter__ or __aexit__? (or others that may exist in future)  I don't know enough about bytecode to know how it'd compare to an instruction for each case.
History
Date User Action Args
2017-03-27 19:53:36Tadhg McDonald-Jensensetrecipients: + Tadhg McDonald-Jensen, r.david.murray, yselivanov
2017-03-27 19:53:36Tadhg McDonald-Jensensetmessageid: <1490644416.45.0.400333071932.issue29922@psf.upfronthosting.co.za>
2017-03-27 19:53:36Tadhg McDonald-Jensenlinkissue29922 messages
2017-03-27 19:53:36Tadhg McDonald-Jensencreate