]> granicus.if.org Git - python/commit
Make sure socket.close() doesn't interfere with socket.makefile().
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 3 Aug 2007 20:40:09 +0000 (20:40 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 3 Aug 2007 20:40:09 +0000 (20:40 +0000)
commit5accbdb8123a814d9a602e7bb640ad7f0e953f54
tree469bbd951bbda9c7c542459a6dc76e2aea1bfd74
parentd2ef864f819ba9b3ef834e190491829bbb00b554
Make sure socket.close() doesn't interfere with socket.makefile().

If a makefile()-generated object is open and its parent socket is
closed, the parent socket should remain open until the child is
closed, too.  The code to support this is moderately complex and
requires one extra slots in the socket object.

This change fixes httplib so that several urllib2net test cases pass
again.

Add SocketCloser class to socket.py, which encapsulates the
refcounting logic for sockets after makefile() has been called.

Move SocketIO class from io module to socket module.  It's only use is
to implement the raw I/O methods on top of a socket to support
makefile().

Add unittests to test_socket to cover various patterns of close and
makefile.
Lib/io.py
Lib/socket.py
Lib/test/test_socket.py