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 yselivanov
Recipients Tadhg McDonald-Jensen, r.david.murray, yselivanov
Date 2017-03-27.17:46:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490636770.11.0.708304673176.issue29922@psf.upfronthosting.co.za>
In-reply-to
Content
> This is a specific example of the general problem reported in issue 25538.

It's a bit different code path/problem.  But I agree, we should work on making both `with` and `async with` a bit more usable.

> Would it be possible to change this so it indicates that it was the context that was invalid not an `await` statement?

I'm not sure if we can do anything about this.  We compile 'async with' into a set of opcodes.  The first ones resolve __aexit__, the latter ones await on it. The one that prepares to await on the aexit (GET_AWAITABLE) is the same that 'await' expression compiles to, and that opcode has no idea what exactly it awaits on.

We could probably add GET_AEXIT_AWAITABLE opcode specifically to improve the error message (other than that it would be a copy of GET_AWAITABLE). I'll think about it.
History
Date User Action Args
2017-03-27 17:46:10yselivanovsetrecipients: + yselivanov, r.david.murray, Tadhg McDonald-Jensen
2017-03-27 17:46:10yselivanovsetmessageid: <1490636770.11.0.708304673176.issue29922@psf.upfronthosting.co.za>
2017-03-27 17:46:10yselivanovlinkissue29922 messages
2017-03-27 17:46:09yselivanovcreate