Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:

The garbage collector does collect unreachable objects.

What happens is that with python 2, the socket is explicitly closed by
the HTTPServer, whereas with python 3, the explicit close() does not
work, and the socket is ultimately closed when the request has finished
and all objects are disposed.

The cause is in the socket.makefile() function: since python3, the
underlying socket uses a reference count, so that:
    s = <a connected socket>
    f = s.makefile()
    s.close()
does not close the socket! adding f.close() is not enough. A "del f" is
necessary to really close the underlying socket.

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to