[ python-Bugs-835300 ] socket object method " makefile" has wrong doc

SourceForge.net noreply at sourceforge.net
Mon Dec 20 16:04:50 CET 2004


Bugs item #835300, was opened at 2003-11-03 15:23
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=835300&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Closed
Resolution: Invalid
Priority: 1
Submitted By: Max Neunhöffer (neunhoef)
Assigned to: Skip Montanaro (montanaro)
Summary: socket object method "makefile" has wrong doc

Initial Comment:
The documentation of the method "makefile" for socket
objects still claims that the new file object
corresponds to a dup()ped file descriptor, which seems
to be wrong.

Python Version: 2.3.2 
Operating system: Debian GNU/Linux

----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2004-12-20 09:04

Message:
Logged In: YES 
user_id=44345

I'm pretty sure I know why you filed this item.  socket.py
contains code to work around shortcomings on Windows and BeOS 
(neither were able to dup() sockets).  At some point we
incorporated that
same code for other platforms for consistency reasons, thus
underlying
sockets are not really dup'd:

>>> import socket
>>> s = socket.socket()
>>> s
<socket._socketobject object at 0x81d9dec>
>>> t = s.dup()
>>> t
<socket._socketobject object at 0x81df02c>
>>> t._sock
<socket object, fd=3, family=2, type=2, protocol=0>
>>> s._sock
<socket object, fd=3, family=2, type=2, protocol=0>
>>> id(s._sock)
136563280
>>> id(t._sock)
136563280

Most of the time this doesn't affect anything, but I believe
it does
in certain cases.


----------------------------------------------------------------------

Comment By: Max Neunhöffer (neunhoef)
Date: 2004-12-20 04:18

Message:
Logged In: YES 
user_id=350896

I can no longer understand what made me file this bug
report. I vaguely remember having had the problem that no
dup was done,
but I am no longer sure what I have seen at the time.
Sorry for the inconvenience!

----------------------------------------------------------------------

Comment By: Irmen de Jong (irmen)
Date: 2004-11-07 13:00

Message:
Logged In: YES 
user_id=129426

Why does this seem to be wrong? 
If I look at the code in socketmodule.c, it seems to me that
sock_makefile does a dup() on the socket's fd, and returns a
file based on the new fd....

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=835300&group_id=5470


More information about the Python-bugs-list mailing list