[issue3826] BaseHTTPRequestHandler depends on GC to close connections

Gregory P. Smith report at bugs.python.org
Sat Nov 29 00:32:05 CET 2008


Gregory P. Smith <greg at krypto.org> added the comment:

Alright I've taken another fresh look at this.  I understand the dup
semantics issue and don't want to break that.

Attached are two patches, either one of these will fix the problem and
breakage.py test code attached to this bug.

Personally I prefer the socket.py patch as I think it will solve this
problem in other places it could potentially pop up.  It calls
self._sock._decref_socketios() from within the SocketIO.close() method
so that after a SocketIO returned by socket.makefile() is closed, it
will no longer prevent the underlying socket from closing.

The socketserver.py patch also works but seems like more of a hack as it
is still relies on immediate reference counted destruction.

Please review.

I'm guessing its too late in the release candidate process for 3.0 to
get this in, but we should do it for 3.0.1.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3826>
_______________________________________


More information about the Python-bugs-list mailing list