-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-128340: make asyncio.events.Handle.cancel() atomic #128347
base: main
Are you sure you want to change the base?
Conversation
graingert
commented
Dec 30, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Add a new internal thread safe handle for asyncio #128340
Lib/asyncio/events.py
Outdated
@property | ||
def _cancelled(self): | ||
return self.cancelled() | ||
|
||
@property | ||
def _callback(self): | ||
callback_args = self._callback_args | ||
if callback_args is _HANDLE_CANCELLED: | ||
return None | ||
return callback_args[0] | ||
|
||
@property | ||
def _args(self): | ||
callback_args = self._callback_args | ||
if callback_args is _HANDLE_CANCELLED: | ||
return None | ||
return callback_args[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests access private attributes - I'd rather update those tests. These properties were just to get a PR up and passing CI quickly.
Misc/NEWS.d/next/Library/2024-12-30-11-38-12.gh-issue-128340.uyqrdQ.rst
Outdated
Show resolved
Hide resolved
@@ -2016,7 +2016,7 @@ def _run_once(self): | |||
ntodo = len(self._ready) | |||
for i in range(ntodo): | |||
handle = self._ready.popleft() | |||
if handle._cancelled: | |||
if handle.cancelled(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant because _run checks now