[New-bugs-announce] [issue24995] better exception message when an unsupported object is passed to `async for` (pep 492)

Yury Selivanov report at bugs.python.org
Thu Sep 3 23:13:47 CEST 2015


New submission from Yury Selivanov:

Should we raise something like "'int' object is not an asynchronous iterable", instead of "'async for' requires an object with __aiter__ method, got int"?


>>> foo().send(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in foo
TypeError: 'async for' requires an object with __aiter__ method, got int


>>> for i in 1: pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable

----------
assignee: yselivanov
components: Interpreter Core
messages: 249689
nosy: gvanrossum, haypo, ncoghlan, yselivanov
priority: normal
severity: normal
status: open
title: better exception message when an unsupported object is passed to `async for` (pep 492)
type: enhancement
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24995>
_______________________________________


More information about the New-bugs-announce mailing list