New submission from Martin Panter:

While looking at a recent failure of test_fileno() in test_urllibnet, I 
discovered that socket.close() ignores the return value of the close() system 
call. It looks like it has always been this way: 
<https://docs.python.org/3/library/socket.html#socket.socket.fileno>.

On the other hand, both FileIO.close() and os.close() raise an exception if the 
underlying close() call fails. So I propose to make socket.close() also raise 
an exception for any failure indicated by the underlying close() call. The 
benefit is that a programming error causing EBADF would be more easily noticed.

----------
components: Extension Modules
files: socket.close.patch
keywords: patch
messages: 262735
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Raise errors from socket.close()
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42342/socket.close.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26685>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to