From 05a47434ae34e48e2ffbff58d871f05158d05a3d Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Tue, 19 May 2020 23:17:24 -0600 Subject: [PATCH 1/3] bpo-39673: Map errno==ETIME to TimeoutError --- Lib/test/test_exception_hierarchy.py | 2 +- .../next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst | 1 + Objects/exceptions.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst diff --git a/Lib/test/test_exception_hierarchy.py b/Lib/test/test_exception_hierarchy.py index 43b4af84039c0cb..805ec05d42cd368 100644 --- a/Lib/test/test_exception_hierarchy.py +++ b/Lib/test/test_exception_hierarchy.py @@ -65,7 +65,7 @@ def test_select_error(self): +-- NotADirectoryError ENOTDIR +-- PermissionError EACCES, EPERM +-- ProcessLookupError ESRCH - +-- TimeoutError ETIMEDOUT + +-- TimeoutError ETIME, ETIMEDOUT """ def _make_map(s): _map = {} diff --git a/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst b/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst new file mode 100644 index 000000000000000..54f0009e25d69f3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst @@ -0,0 +1 @@ +Map ``errno==ETIME`` to :exc:`TimeoutError`. diff --git a/Objects/exceptions.c b/Objects/exceptions.c index db5e3da12b00f3c..970b266688d0d7e 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2627,6 +2627,7 @@ _PyExc_Init(void) ADD_ERRNO(PermissionError, EPERM); ADD_ERRNO(ProcessLookupError, ESRCH); ADD_ERRNO(TimeoutError, ETIMEDOUT); + ADD_ERRNO(TimeoutError, ETIME); return _PyStatus_OK(); From 9e7db67ffa4ff882daa5062ba01c9d0cea76d8e1 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Wed, 20 May 2020 15:01:20 -0600 Subject: [PATCH 2/3] Update Doc/library/exceptions.rst --- Doc/library/exceptions.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index df2cda9d67ad153..1d1dff631e3736b 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -654,7 +654,10 @@ depending on the system error code. .. exception:: TimeoutError Raised when a system function timed out at the system level. - Corresponds to :c:data:`errno` ``ETIMEDOUT``. + Corresponds to :c:data:`errno` ``ETIMEDOUT`` and ``ETIME``. + + .. versionchanged:: 3.10 + ``ETIME`` is now mapped to :exc:`TimeoutError`. .. versionadded:: 3.3 All the above :exc:`OSError` subclasses were added. From c12cb39bbef9ffb16980cdf5905b070dc88bc4e1 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Tue, 26 May 2020 07:30:49 -0400 Subject: [PATCH 3/3] Update 2020-05-19-23-16-53.bpo-39673.ppfScY.rst Updated blurb to reflect that it's an OSError that's being mapped to a TimeoutError. --- .../next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst b/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst index 54f0009e25d69f3..629fa72fc0caf26 100644 --- a/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst +++ b/Misc/NEWS.d/next/Library/2020-05-19-23-16-53.bpo-39673.ppfScY.rst @@ -1 +1 @@ -Map ``errno==ETIME`` to :exc:`TimeoutError`. +Map :exc:`OSError` with ``errno==ETIME`` to :exc:`TimeoutError`.