Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Doc/library/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,9 @@ depending on the system error code.
Raised when a system function timed out at the system level.
Corresponds to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`.

.. versionchanged:: 3.10
``ETIME`` is now mapped to :exc:`TimeoutError`.

.. versionadded:: 3.3
All the above :exc:`OSError` subclasses were added.

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_exception_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_select_error(self):
+-- NotADirectoryError ENOTDIR
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
+-- ProcessLookupError ESRCH
+-- TimeoutError ETIMEDOUT
+-- TimeoutError ETIME, ETIMEDOUT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this test is as good as we're going to get.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I'm having second thoughts w.r.t. this PR (especially after the discussion
on python-dev). I don't know a lot about ETIME. I'm not sure if I should have submitted this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZackerySpytz No need to worry, its only being added to future version of python. With more and more async style coding being adapted ETIME will be handy to have as TimeoutError. It should have been adapted a long time ago but i suppose no one wanted to bother submitting a PR for it.

"""
def _make_map(s):
_map = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Map :exc:`OSError` with ``errno==ETIME`` to :exc:`TimeoutError`.
1 change: 1 addition & 0 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -3741,6 +3741,7 @@ _PyExc_InitState(PyInterpreterState *interp)
#endif
ADD_ERRNO(ProcessLookupError, ESRCH);
ADD_ERRNO(TimeoutError, ETIMEDOUT);
ADD_ERRNO(TimeoutError, ETIME);

return _PyStatus_OK();

Expand Down