Visitar URL original
Description of asyncio.Event.clear inconsistent with threading.Event.clear · Issue #101359 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250519072349/https://github.com/python/cpython/issues/101359
Skip to content

Description of asyncio.Event.clear inconsistent with threading.Event.clear #101359

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

Open
paul1261 opened this issue Jan 26, 2023 · 3 comments
Open
Labels
docs Documentation in the Doc dir topic-asyncio

Comments

@paul1261
Copy link

Documentation

The wording of asyncio.Event.clear is not consistent with threading.Event.clear. The difference can cause programmers to suspect a difference in behavior, which is not the case. The threading.Event wording makes it clear that threads will block on subsequent calls to Event.wait() if the flag is cleared. With the asyncio.Event wording this is less clear, possibly leading programmers to expect a sufficiently quick call to Event.set() will result in some tasks failing to proceed through an await event.wait() expression.

This issue was raised by a question on StackOverflow. I don't see a rationale for the difference in wording.

@paul1261 paul1261 added the docs Documentation in the Doc dir label Jan 26, 2023
@github-project-automation github-project-automation bot moved this to Todo in asyncio Jan 26, 2023
@gvanrossum
Copy link
Member

@paul1261 Can you please provide links to everything you mentioned? Both versions of the docs and the stackoverflow issue.

@paul1261
Copy link
Author

threading.Event docs
file:///C:/Program%20Files/Python311/Doc/html/library/threading.html?highlight=threading%20event#threading.Event.clear
asyncio.Event.docs
https://docs.python.org/3/library/asyncio-sync.html?highlight=asyncio%20event%20clear#asyncio.Event.clear
SO question
https://stackoverflow.com/questions/75241063/clarify-asyncio-event-semantics

@gvanrossum
Copy link
Member

So you want the word “subsequent” in there somewhere? Can you make a PR so we’re on the same page?

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 topic-asyncio
Projects
Status: Todo
Development

No branches or pull requests

3 participants