Issue1120

classification
Title: invalid socket shutdown gives AssertionError, should be "transport endpoint not connected" socket.error
Type: Severity: normal
Components: Versions: 2.2.2
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, glyph
Priority: normal Keywords: twisted

Created on 2008-09-06.16:27:58 by glyph, last changed 2008-09-13.18:19:19 by amak.

Messages
msg3473 (view) Author: Glyph Lefkowitz (glyph) Date: 2008-09-06.16:27:58
From CPython:

>>> import socket
>>> socket.socket(socket.AF_INET, socket.SOCK_STREAM)
<socket._socketobject object at 0xb7d71aac>
>>> s = _
>>> s.shutdown(socket.SHUT_RDWR)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in shutdown
socket.error: (107, 'Transport endpoint is not connected')

From Jython:

>>> import socket
>>> socket.socket(socket.AF_INET, socket.SOCK_STREAM)
<socket._socketobject object at 1>
>>> s = _
>>> s.shutdown(socket.SHUT_RDWR)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in shutdown
  File "/home/glyph/Projects/Jython/trunk/jython/dist/Lib/socket.py",
line 810, in shutdown
    assert self.sock_impl
AssertionError
msg3502 (view) Author: Alan Kennedy (amak) Date: 2008-09-13.12:19:04
This is indeed a bug, albeit a bug that appears when an invalid series
of operations is carried out on a socket, as noted by the OP.

I will check in a fix today.
msg3517 (view) Author: Alan Kennedy (amak) Date: 2008-09-13.18:19:19
Fix checked into trunk and release 2.2.

The illustrated series of operations from the code above will now behave
correctly on jython, i.e. the correct socket.error will be raised, with
the correct errno == errno.ENOTCONN.

Thanks for reporting this bug.
History
Date User Action Args
2008-09-13 18:19:19amaksetstatus: open -> closed
resolution: fixed
messages: + msg3517
2008-09-13 12:19:04amaksetpriority: normal
assignee: amak
messages: + msg3502
nosy: + amak
versions: + 2.2.2
2008-09-06 16:30:20nrileysetkeywords: + twisted
2008-09-06 16:27:58glyphcreate