[issue13344] closed sockets don't raise EBADF anymore

Antoine Pitrou report at bugs.python.org
Fri Nov 4 22:14:46 CET 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

This decrepancy between 2.x and 3.x is witnessed under Windows:

Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> sock = socket.create_connection(("www.python.org", 80))
>>> sock.close()
>>> sock.send(b"x")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python27\lib\socket.py", line 170, in _dummy
    raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor

Python 3.2.1 (default, Jul 10 2011, 20:02:51) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> sock = socket.socket(); sock.connect(("www.python.org", 80))
>>> sock.close()
>>> sock.send(b"x")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: [Errno 10038] An operation was attempted on something that is not
a socket


I'm not sure this is worth fixing, though.

----------
components: Library (Lib)
messages: 147039
nosy: exarkun, pitrou
priority: low
severity: normal
status: open
title: closed sockets don't raise EBADF anymore
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13344>
_______________________________________


More information about the Python-bugs-list mailing list