classification
Title: Closing a socket when makefile() is used
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, martin.panter, pitrou, python-dev
Priority: normal Keywords:

Created on 2013-12-04 07:21 by martin.panter, last changed 2013-12-04 20:16 by pitrou. This issue is now closed.

Messages (4)
msg205200 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2013-12-04 07:21
I think the documentation is rather vague about closing the underlying OS socket. Can someone verify if the following is true (*asterisked* bits are my additions), and maybe update the documentation?

socket.close(): Close the socket *object*. *The underlying file descriptor is also closed, unless there are file objects from makefile() still open.*

socket.makefile(): Closing the file object won’t close the *file descriptor* unless *the original socket object and any other file objects have already been closed*.
msg205240 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-04 19:46
Your observations are right, indeed. I'll make the doc changes.
msg205243 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-04 20:15
New changeset e10bb7c1b8f8 by Antoine Pitrou in branch '3.3':
Issue #19882: tweak docs for socket.close()
http://hg.python.org/cpython/rev/e10bb7c1b8f8
msg205244 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-04 20:16
Fixed, thanks!
History
Date User Action Args
2013-12-04 20:16:23pitrousetstatus: open -> closed
resolution: fixed
messages: + msg205244

stage: patch review -> resolved
2013-12-04 20:15:59python-devsetnosy: + python-dev
messages: + msg205243
2013-12-04 19:46:25pitrousetversions: + Python 2.7
nosy: + pitrou

messages: + msg205240

stage: patch review
2013-12-04 07:21:06martin.pantercreate