This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fviard
Recipients fviard
Date 2013-10-03.17:12:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In Lib/http/ +682    (Formerly httplib)

    def fileno(self):
        return self.fp.fileno()

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.:
    def fileno(self):
        if self.fp:
            return self.fp.fileno()
            return -1

I encountered the issue in the following context:
while 1:
  read_list = select([req], ...)[0]
  if read_list:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nappstore/", line 211, in download_file
    ready =[req], [], [], timeout)[0]
  File "/usr/lib/python2.7/", line 313, in fileno
    return self._sock.fileno()
  File "/usr/lib/python2.7/", line 655, in fileno
    return self.fp.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. 
In Lib/
  -1 is returned in case of ValueError (no fileno value as fp was closed)
but in Lib/
  ValueError is raised in that case and default value for fileno for a socket is None
Date User Action Args
2013-10-03 17:12:39fviardsetrecipients: + fviard
2013-10-03 17:12:38fviardsetmessageid: <>
2013-10-03 17:12:38fviardlinkissue19154 messages
2013-10-03 17:12:38fviardcreate