Daniel Urban <urban.dani...@gmail.com> added the comment:

I think the patch isn't entirely correct.  It uses PyIter_Check for detecting 
the case when an *iterable* raises TypeError, but that function actually checks 
for an *iterator*.  The check on the tp_iter member mentioned by Amaury Forgeot 
d'Arc probably would be better, but even that wouldn't detect every iterable: 
"Its presence normally signals that the instances of this type are iterable 
(although sequences may be iterable without this function)." 
(http://docs.python.org/dev/py3k/c-api/typeobj.html#PyTypeObject.tp_iter)  
(Apparently any object with a __getitem__ is iterable.  By the way, 
collections.abc.Iterable also doesn't detect this case.)

----------
versions: +Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4806>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to