[ python-Bugs-1620945 ] minor inconsistency in socket.close

SourceForge.net noreply at sourceforge.net
Sun Feb 25 23:48:10 CET 2007


Bugs item #1620945, was opened at 2006-12-22 18:05
Message generated for change (Comment added) made by jhylton
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1620945&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Jonathan Ellis (ellisj)
Assigned to: Nobody/Anonymous (nobody)
Summary: minor inconsistency in socket.close

Initial Comment:
In python 2.5 socket.close, all methods are delegated to _dummy, which raises an error.  It would be more consistent to delegate each method to its counterpart in _closedsocket; in particular re-closing a closed socket is not intended to raise:

    def close(self):
        self._sock.close()
        self._sock = _closedsocket()
        for method in _delegate_methods:
            setattr(self, method, getattr(self._sock, method))


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

>Comment By: Jeremy Hylton (jhylton)
Date: 2007-02-25 22:48

Message:
Logged In: YES 
user_id=31392
Originator: NO

Re-closing a socket does not raise an exception.  If there is something
else in your bug report that I am missing, please re-open it.


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

Comment By: Mark Roberts (mark-roberts)
Date: 2007-01-20 01:51

Message:
Logged In: YES 
user_id=1591633
Originator: NO

On trunk:

>>> import socket
>>> s=socket.socket()
>>> s.close()
>>> s.close()
>>> 

It also seems that the following line will make even that remapping not
useful?  Isn't it better just to avoid the layer of indirection and
directly proceed with assigning to _dummy?

line 145: send = recv = recv_into = sendto = recvfrom = recvfrom_into =
_dummy

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

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


More information about the Python-bugs-list mailing list