[issue1327971] HTTPResponse instance has no attribute 'fileno'
Senthil Kumaran orsent...@gmail.com added the comment: Fix committed in revision 84932. A property based fileno was not required, because it is hardly set, it is always often a read-only attribute. Also, py3k behavior is same as the current fix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Senthil Kumaran orsent...@gmail.com added the comment: Documented it in r84933, r84934 and r84935 -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Senthil Kumaran orsent...@gmail.com: -- assignee: - orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- versions: +Python 2.7 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Kevin Dwyer kevin.p.dw...@gmail.com: -- nosy: +kevindication ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Mark Lawrence breamore...@yahoo.co.uk added the comment: These patches are small and marked as easy, can they be accepted? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: -- keywords: +easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: -- nosy: +orsenthil versions: -Python 2.4, Python 2.5, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: -- nosy: +jjlee ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Daniel Diniz aja...@gmail.com added the comment: OK, I'll work on a test + patch. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Daniel Diniz aja...@gmail.com added the comment: IMHO, using a fileno property looks better than __getattr__. Setting an attribute in init works too, unless fp changes during the object life (then 3.x is broken IIUC). It works OK as a property of either urllib.addinfourl or of httplib.HTTPResponse (socket would work, but is this broken there or a higher layer). Tests and fixes for both solutions attached. As soon as one is chosen, some docs on fileno would be nice, even for 3.x. This (current) test in test_urllibnet.py passes, but I don't see how to improve it, assuming it should fail/detect this bug (maybe self.urlopen isn't testing urllib.urlopen correctly?): def test_fileno(self): if (sys.platform in ('win32',) or not hasattr(os, 'fdopen')): # On Windows, socket handles are not file descriptors; this # test can't pass on Windows. return # Make sure fd returned by fileno is valid. open_url = self.urlopen(http://www.python.org/;) fd = open_url.fileno() FILE = os.fdopen(fd) -- keywords: +patch stage: test needed - patch review Added file: http://bugs.python.org/file13030/httplib_fileno.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: -- components: +Library (Lib) -None type: - behavior Added file: http://bugs.python.org/file13031/urllib_fileno.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Daniel Diniz aja...@gmail.com added the comment: Hmm, always run all the tests :) fileno is set in test_urllib2. New patches. Added file: http://bugs.python.org/file13032/httplib_fileno_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: Removed file: http://bugs.python.org/file13030/httplib_fileno.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: Added file: http://bugs.python.org/file13033/urllib_fileno_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Changes by Daniel Diniz aja...@gmail.com: Removed file: http://bugs.python.org/file13031/urllib_fileno.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Daniel Diniz aja...@gmail.com added the comment: The urllib patch breaks test_pyclbr because test_pyclbr can't handle properties. I think the test is wrong here, hence the hack attached... otherwise, let's go with httplib. Added file: http://bugs.python.org/file13036/test_pyclbr_property.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Georg Brandl ge...@python.org added the comment: Well, easy access is not the point. If the object is supposed to have the file-like interface, and can provide a fileno(), it should. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Brett Cannon br...@python.org added the comment: Georg is right and this has been fixed apparently in 3.0, leaving 2.7 and older broken. There are two possible solutions to this. One is to change socket._fileobject.fileno() to simply try self._sock.fp.fileno() if self._sock.fileno() does not exist. The other option is to add a __getattr__ to httplib.HTTPResponse to redirect to self.fp. Anyone have an opinion? -- nosy: +brett.cannon stage: - test needed versions: +Python 2.4, Python 2.5, Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Brett Cannon br...@python.org added the comment: Another option is to change urllib.addinfourl to look for fileno() on an HTTPResponse object. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1327971] HTTPResponse instance has no attribute 'fileno'
Daniel Diniz aja...@gmail.com added the comment: Besides being outdated, the OP shows it's trivial to access the fileno: r.fileno = r.fp.fileno. I suggest closing. -- nosy: +ajaksu2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1327971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com