Why does sock.close() not actually close sock?

If I run the code

import socket
sock = socket.socket()
...
sock.close()

I would expect that a system call is done to actually close the socket and free the file descriptor. But that does not happen. Look at the code in socket.py. It merely replaces the socket instance with a dummy instance so that all subsequent calls on the sock object fail, but it does nothing else!

--
Sjoerd Mullender
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to