[issue24528] Misleading exeption for await in comprehensions.
Ivan Levkivskyi added the comment: Yury, thank you for the patch, the error message is much clearer now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24528] Misleading exeption for await in comprehensions.
Roundup Robot added the comment: New changeset 30b676e8b21f by Yury Selivanov in branch '3.5': Issue #24528: Improve error message for awaits in comprehensions https://hg.python.org/cpython/rev/30b676e8b21f New changeset 9598bc916186 by Yury Selivanov in branch 'default': Merge 3.5 (Issue #24528) https://hg.python.org/cpython/rev/9598bc916186 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24528] Misleading exeption for await in comprehensions.
Changes by Yury Selivanov yseliva...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24528] Misleading exeption for await in comprehensions.
Changes by Yury Selivanov yseliva...@gmail.com: -- assignee: - yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24528] Misleading exeption for await in comprehensions.
New submission from Ivan Levkivskyi: The following code: async def foo(): lst = [await coro(i) for i in range(10)] return lst gives SyntaxError: 'await' outside async function I understand that this is because the comprehensions are implemented using a function scope (see also #10544), but such behavior is unintuitive. IMO there are two possibilities here: 1) make comprehensions behave more like a for loop; 2) change the exception text to something like SyntaxError: 'await's in comprehensions are not supported. I understand that the first option is probably not for 3.5 (it is beta already), but I will be happy if the second option will be implemented in 3.5 -- components: Interpreter Core, asyncio messages: 245931 nosy: gvanrossum, haypo, levkivskyi, yselivanov priority: normal severity: normal status: open title: Misleading exeption for await in comprehensions. type: behavior versions: Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24528] Misleading exeption for await in comprehensions.
Yury Selivanov added the comment: Thanks for discovering this, Ivan. The patch is attached. -- keywords: +needs review, patch nosy: +ncoghlan stage: - patch review Added file: http://bugs.python.org/file39834/awaitcomp.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com