[docs] [issue19154] AttributeError: 'NoneType' in http/client.py when using select when file descriptor is closed.

Terry J. Reedy report at bugs.python.org
Tue Oct 8 22:36:40 CEST 2013

Terry J. Reedy added the comment:

Florent, for future reference, marking an issue for 2.7 says to us "I  want this fixed for 2.7".

I agree that having 3 different error indicators for 3 similar functions is nasty. But this is partly due to the difference between object that *has* a fd (socket) versus a object that *wraps such an object. The problem is that changing any of them could break code that just uses one of them. 

The select doc says that a 'waitable' object must have .fileno() that return a valid fd int. It says nothing about an allowed error return. This could be interpreted as meaning that not returning an fd int makes the object (such as a closed HTTPResponse) unwaitable. Or this could be interpreted as a deficiency in the select doc or code. In the module/selectmodule.c code, the various poll methods interpret -1 as the error return for a closed fd. I do not know how it deals with socket.fileno raising ValueError (or returning None?).

In the client doc, none of several examples of using HTTPResponses use select. They just use the various methods to retrieve data. I could interpret this to mean that they are not intended to work with select. The fact that they do not, reinforces that.


Python tracker <report at bugs.python.org>

More information about the docs mailing list