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.

classification
Title: Incorrect documentation for socket.py on linux
Type: behavior Stage: resolved
Components: Documentation, IO Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, Shane.Hansen, docs@python, eric.snow, georg.brandl, pitrou, python-dev
Priority: normal Keywords:

Created on 2012-03-14 16:58 by Shane.Hansen, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py Shane.Hansen, 2012-03-14 16:58 script which asserts that dup() was called and the object returned by makefile has a different fileno() than the socket.
Messages (3)
msg155768 - (view) Author: Shane Hansen (Shane.Hansen) Date: 2012-03-14 16:58
The python docs state that for socket.makefile "The file object references a dup()ped version of the socket file descriptor, so the file object and socket object may be closed or garbage-collected independently."

In fact for socket.py dup() is never called, and no additional files are opened. Instead an object is returned which uses the original socket and does buffering.

For me, this is the desired behaviour, but just thought I'd mention the docs were off.
msg228592 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-10-05 17:27
Shane, there are major differences between the makefile docs versions 2 and 3, so could you prepare a patch for this addressed at version 2 only?
msg228697 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-06 14:37
New changeset 6e2a72e05b4f by Georg Brandl in branch '2.7':
Closes #14303: socket.makefile() does not call dup() anymore on the socket fd.
https://hg.python.org/cpython/rev/6e2a72e05b4f
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58511
2014-10-06 14:37:04python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg228697

resolution: fixed
stage: resolved
2014-10-05 17:27:53BreamoreBoysetnosy: + BreamoreBoy

messages: + msg228592
versions: - Python 2.6
2013-06-15 05:29:55eric.snowsetnosy: + eric.snow
2012-03-14 16:58:17Shane.Hansencreate