This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: stdib should use new exception types from PEP 3151
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: 16644 16645 16646 16647 16650 16704 16705 16714 16719 16720 23234 Superseder:
Assigned To: Nosy List: asvetlov, martin.panter, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2012-12-08 19:35 by asvetlov, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg177174 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-08 19:35 define exception classes like ConnectionError and BrokenPipeError

We need to refactor stdlib to use that shiny new exceptions instead of checking errno values if possible.

Also maybe we need to add some absent exceptions.
I guess NotConnectedError for ENOTCONN, which should be ConnectionError subclass.
msg177175 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-08 19:44
Right now I'm working on a patch. ;) A pack of issues were produced in process.
msg177176 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-08 19:54
Please, feel free to add me in nosylist for any issue related to this one.
msg234295 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-01-18 23:59
I would support adding ENOTCONN under the ConnectionError umbrella. It is caught for shutdown() calls in a few standard library modules. Here is a demo showing how to trigger it (at least on Linux):

from socket import create_connection, SHUT_RDWR
from socketserver import TCPServer, BaseRequestHandler
from threading import Thread

server = TCPServer(("", 0), BaseRequestHandler)
client = create_connection(server.server_address)
server.shutdown()  # Ensure server has closed client connection

>>> client.shutdown(SHUT_RDWR)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 107] Transport endpoint is not connected
msg234550 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-01-23 09:41
Oh, I didn't know this issue. FYI I modified the subprocess module to use new specialized OSError exceptions: issue #23234 (changeset 0c5ae257966f).
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60852
2018-01-29 13:48:51asvetlovsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2015-01-23 10:56:04serhiy.storchakasetdependencies: + refactor subprocess: use new OSError exceptions, factorize stdin.write() code
2015-01-23 09:41:18vstinnersetnosy: + vstinner
messages: + msg234550
2015-01-18 23:59:02martin.pantersetnosy: + martin.panter
messages: + msg234295
2012-12-18 22:08:27serhiy.storchakasetdependencies: + Get rid of os.error. Use OSError instead
2012-12-18 21:33:41serhiy.storchakasetdependencies: + Get rid of WindowsError. Use OSError instead
2012-12-18 18:13:42serhiy.storchakasetdependencies: + Raise exceptions, don't throw
2012-12-17 20:31:54asvetlovsetdependencies: + Use concrete classes inherited from OSError instead of errno check
2012-12-17 20:10:24asvetlovsetdependencies: + Get rid of select.error in stdlib. Use OSError instead
2012-12-15 22:01:23serhiy.storchakasetdependencies: + Wrong code in ContextManagerTests.test_invalid_args() in, Wrong test_extract_hardlink() in, FTP.makeport() loses socket error details, LMTP.connect() loses socket error details, Popen._internal_poll() references errno.ECHILD outside of the local scope
2012-12-08 19:54:46asvetlovsetmessages: + msg177176
2012-12-08 19:44:17serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg177175
2012-12-08 19:35:47asvetlovcreate