This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Closing a socket when makefile() is used
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
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 2022-04-11 14:57 by admin. 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()
msg205244 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-12-04 20:16
Fixed, thanks!
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 64081
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