[issue4608] urllib.request.urlopen does not return an iterable object
Roundup Robot devnull@devnull added the comment: New changeset c0a68b948f5d by Raymond Hettinger in branch '3.2': Issue #4608: urllib.request.urlopen does not return an iterable object http://hg.python.org/cpython/rev/c0a68b948f5d New changeset d4aeeddf72e3 by Raymond Hettinger in branch 'default': Issue #4608: urllib.request.urlopen does not return an iterable object http://hg.python.org/cpython/rev/d4aeeddf72e3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Raymond Hettinger raymond.hettin...@gmail.com added the comment: Thanks for the patch. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Stefan Schwarzer sschwar...@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 rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: flox - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Rafael Zanella rafael.zane...@yahoo.com.br added the comment: The patch that makes addinfourl() iterable was not commited due to the change to HTTP request see: msg86365 (http://bugs.python.org/issue4608#msg86365). Since urllib is protocol agnostic it should behave the same with FTP, right? So, where to fix? Change the addinfourl() to become itrable or change the FTPHandler return? -- nosy: +zanella ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Albert Hopkins mar...@python.net added the comment: This issue appears to persist when the protocol used is FTP: root@tp-db $ cat test.py from urllib.request import urlopen for line in urlopen('ftp://gentoo.osuosl.org/pub/gentoo/releases/'): print(line) break root@tp-db $ python3.2 test.py Traceback (most recent call last): File test.py, line 2, in module for line in urlopen('ftp://gentoo.osuosl.org/pub/gentoo/releases/'): TypeError: 'addinfourl' object is not iterable -- nosy: +marduk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Albert Hopkins mar...@python.net added the comment: Oops, previous example was a directory, but it's the same if the url points to a ftp file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Brian Brazil brian.bra...@gmail.com added the comment: This looks as though its a short write: [pid 28343] recvfrom(5, GET / HTTP/1.1\r\nAccept-Encoding:..., 8192, 0, NULL, NULL) = 118 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, HTTP/1.0 200 OK\r\n, 17, 0, NULL, 0) = 17 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, Server: TestHTTP/ Python/3.2a1+\r..., 33, 0, NULL, 0) = 33 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, Date: Sun, 08 Aug 2010 09:41:08 ..., 37, 0, NULL, 0) = 37 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, Content-type: text/plain\r\n, 26, 0, NULL, 0) = 26 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, \r\n, 2, 0, NULL, 0) = 2 [pid 28343] poll([{fd=5, events=POLLOUT, revents=POLLOUT}], 1, 1) = 1 [pid 28343] sendto(5, verylongverylongverylongverylong..., 56001, 0, NULL, 0) = 49054 [pid 28343] shutdown(5, 1 /* send */) = 0 -- nosy: +bbrazil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Brian Brazil brian.bra...@gmail.com added the comment: The attached patch handles short writes, and adds ajaksu2's tests. -- Added file: http://bugs.python.org/file18433/tests-iter-urllib-py3k.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Florent Xicluna florent.xicl...@gmail.com added the comment: Thanks, Brian. Pushed with revision 83833. -- assignee: facundobatista - flox nosy: +flox resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.2 -Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Senthil orsent...@gmail.com added the comment: This issue is already fixed by jeremy at Revision 70815, wherein The response from an HTTP request is now an HTTPResponse instance instead of an addinfourl() wrapper instance. So the issue won't be present in the py3k code ( confirmed). However, the test added by Daniel,which tests for urlopen() for a request which is bverylong * 8192 still fails. It is not just with iteration; but test_200 will fail too if the request is a large chunk. This is only in py3k branch, test will pass in the trunk code. I am investigating further. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Daniel Diniz aja...@gmail.com: -- keywords: +easy priority: - high stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Daniel Diniz aja...@gmail.com added the comment: Test cases attached. The second one highlights a bug in the current patch, as it fails to return a line longer than 65475 chars. This behavior doesn't match trunk's. -- nosy: +ajaksu2 Added file: http://bugs.python.org/file12987/tests_issue4608_py31.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Facundo Batista facu...@taniquetil.com.ar added the comment: Senthil, do you think you could provide a test case for this? Thank you! -- assignee: - facundobatista nosy: +facundobatista ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Jakub Wilk uba...@users.sf.net added the comment: Oops, __next__ is OK. Sorry for the confusion. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Senthil orsent...@gmail.com added the comment: Jakub, I have attached a revision to the patch. You are right, when __iter__ returns self.fp (as in previous patch), the __next__ is superflous. But, I was thinking of __iter__ returning an instance of addbase, instead of self.fp and in that case __next__ was required. But I see that i had not changed self.fp to self. This is implemented in the similar lines of IOBase class, io.py w.r.t to your other comment, why do you think __next__ implementation is incorrect? Thanks, Senthil Added file: http://bugs.python.org/file12548/issue4608_py31-v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Jakub Wilk uba...@users.sf.net added the comment: Regarding Senthil's patch: __next__() method seems superfluous to me (and the implementation is buggy). ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Senthil orsent...@gmail.com added the comment: Here is a patch to fix the issue. Jeremy, is it approach okay? Or do you have any other suggestion? -- keywords: +patch Added file: http://bugs.python.org/file12410/issue4608_py31.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Senthil orsent...@gmail.com: -- versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Senthil [EMAIL PROTECTED] added the comment: I verified this bug in the Py3.0 and Py3.1. Shall come out with a patch for it. -- nosy: +orsenthil ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
New submission from Jakub Wilk [EMAIL PROTECTED]: $ cat urltest2.5 #!/usr/bin/python2.5 from urllib2 import urlopen for line in urlopen('http://python.org/'): print line break $ ./urltest2.5 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; $ cat urltest3.0 #!/usr/bin/python3.0 from urllib.request import urlopen for line in urlopen('http://python.org/'): print(line) break $ ./urltest3.0 Traceback (most recent call last): File ./urltest3.0, line 3, in module for line in urlopen('http://python.org/'): TypeError: 'addinfourl' object is not iterable -- components: Library (Lib) messages: 77405 nosy: jwilk, pl severity: normal status: open title: urllib.request.urlopen does not return an iterable object type: behavior versions: Python 3.0 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [issue4608] urllib.request.urlopen does not return an iterable object
Oops. I didn't think it translate the code in addinfobase to the new style of iterators. Jeremy On Tue, Dec 9, 2008 at 7:50 AM, Senthil [EMAIL PROTECTED] wrote: Senthil [EMAIL PROTECTED] added the comment: I verified this bug in the Py3.0 and Py3.1. Shall come out with a patch for it. -- nosy: +orsenthil ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com