[New-bugs-announce] [issue19154] AttributeError: 'NoneType' in http/client.py when using select when file descriptor is closed.
report at bugs.python.org
Thu Oct 3 19:12:38 CEST 2013
New submission from Florent Viard:
In Lib/http/client.py +682 (Formerly httplib)
This function should be modified to be able to handle the case where the http request is already completed and so "fp" is closed. Ex.:
I encountered the issue in the following context:
read_list = select([req], ...)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/nappstore/server_comm.py", line 211, in download_file
ready = select.select([req], , , timeout)
File "/usr/lib/python2.7/socket.py", line 313, in fileno
File "/usr/lib/python2.7/httplib.py", line 655, in fileno
AttributeError: 'NoneType' object has no attribute 'fileno'
For the returned value, I'm not sure because there is currently 2 different cases for other objects returning a fileno.
-1 is returned in case of ValueError (no fileno value as fp was closed)
but in Lib/socket.py:
ValueError is raised in that case and default value for fileno for a socket is None
components: Library (Lib)
title: AttributeError: 'NoneType' in http/client.py when using select when file descriptor is closed.
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce