Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio docs refer to wrong TimeoutError #65575

Closed
qmega mannequin opened this issue Apr 28, 2014 · 5 comments
Closed

asyncio docs refer to wrong TimeoutError #65575

qmega mannequin opened this issue Apr 28, 2014 · 5 comments
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir

Comments

@qmega
Copy link
Mannequin

qmega mannequin commented Apr 28, 2014

BPO 21376
Nosy @gvanrossum, @pitrou, @vstinner, @giampaolo, @1st1

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-05-28.22:06:16.801>
created_at = <Date 2014-04-28.18:05:57.039>
labels = ['library', 'docs']
title = 'asyncio docs refer to wrong TimeoutError'
updated_at = <Date 2014-05-28.22:06:16.800>
user = 'https://bugs.python.org/qmega'

bugs.python.org fields:

activity = <Date 2014-05-28.22:06:16.800>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2014-05-28.22:06:16.801>
closer = 'vstinner'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2014-04-28.18:05:57.039>
creator = 'qmega'
dependencies = []
files = []
hgrepos = []
issue_num = 21376
keywords = []
message_count = 5.0
messages = ['217390', '217400', '217402', '219310', '219311']
nosy_count = 8.0
nosy_names = ['gvanrossum', 'pitrou', 'vstinner', 'giampaolo.rodola', 'docs@python', 'python-dev', 'yselivanov', 'qmega']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue21376'
versions = ['Python 3.4', 'Python 3.5']

@qmega
Copy link
Mannequin Author

qmega mannequin commented Apr 28, 2014

Example: https://docs.python.org/3.4/library/asyncio-task.html
TimeoutError is mentioned several times, and links to the OSError subclass. However, the actual TimeoutError raised by asyncio stuff is the one from concurrent.futures, which is not compatible. The docs as they are seem to suggest that something like "except TimeoutError" would be appropriate, when in fact that would not produce the expected behavior; "except asyncio.TimeoutError" is what you'd want.

@qmega qmega mannequin assigned docspython Apr 28, 2014
@qmega qmega mannequin added the docs Documentation in the Doc dir label Apr 28, 2014
@pitrou
Copy link
Member

pitrou commented Apr 28, 2014

Gasp. Perhaps concurrent.futures.TimeoutError can inherit from the standard TimeoutError? The following patch doesn't seem to disrupt the test suite:

diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py
--- a/Lib/concurrent/futures/_base.py
+++ b/Lib/concurrent/futures/_base.py
@@ -49,7 +49,7 @@ class CancelledError(Error):
     """The Future was cancelled."""
     pass
 
-class TimeoutError(Error):
+class TimeoutError(Error, TimeoutError):
     """The operation exceeded the given deadline."""
     pass

@pitrou pitrou added the stdlib Python modules in the Lib dir label Apr 28, 2014
@gvanrossum
Copy link
Member

I considered this, and decided against unifying the two TimeoutErrors.

First the builtin TimeoutError is specifically a subclass of OSError representing the case where errno is ETIMEDOUT. But asyncio.TimeoutError means nothing of the sort.

Second, the precedent is concurrent.futures.TimeoutError. The asyncio one is used under the same conditions as that one.

I think we should just update the links in the docs to be correct.

@python-dev
Copy link
Mannequin

python-dev mannequin commented May 28, 2014

New changeset 6d90e8df01f4 by Victor Stinner in branch '3.4':
Issue bpo-21376: document asyncio.TimeoutError
http://hg.python.org/cpython/rev/6d90e8df01f4

New changeset 03bb1077b362 by Victor Stinner in branch 'default':
(Merge 3.4) Issue bpo-21376: document asyncio.TimeoutError
http://hg.python.org/cpython/rev/03bb1077b362

@vstinner
Copy link
Member

Thanks for the report. In fact, asyncio.TimeoutError was not documented at all. It should now be fixed.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

3 participants