[issue4608] urllib.request.urlopen does not return an iterable object

Stefan Schwarzer report at bugs.python.org
Sat Jun 25 18:37:52 CEST 2011


Stefan Schwarzer <sschwarzer at users.sourceforge.net> added the comment:

It turned out that although the addinfourl instance had the `__iter__` attribute in `addbase.__init__` correctly assigned, `__iter__` wasn't found by the `iter` builtin. It seems that `iter` always tries to use the `__iter__` method of the _class_ and doesn't look at the instance.

Riccardo Attilio Galli and I made the attached patch. The patch also fixes a corresponding `TypeError` for "file://" URLs, not just "ftp://" URLs.

----------
nosy: +sschwarzer
Added file: http://bugs.python.org/file22474/issue4608.diff

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


More information about the Python-bugs-list mailing list