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 <rep...@bugs.python.org>
<http://bugs.python.org/issue24995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to