gh-128340: make asyncio.events.Handle.cancel() atomic#128347
Draft
graingert wants to merge 5 commits intopython:mainfrom
Draft
gh-128340: make asyncio.events.Handle.cancel() atomic#128347graingert wants to merge 5 commits intopython:mainfrom
graingert wants to merge 5 commits intopython:mainfrom
Conversation
graingert
commented
Dec 30, 2024
Lib/asyncio/events.py
Outdated
Comment on lines
+105
to
+121
| @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] |
Contributor
Author
There was a problem hiding this comment.
the tests access private attributes - I'd rather update those tests. These properties were just to get a PR up and passing CI quickly.
graingert
commented
Dec 30, 2024
Misc/NEWS.d/next/Library/2024-12-30-11-38-12.gh-issue-128340.uyqrdQ.rst
Outdated
Show resolved
Hide resolved
graingert
commented
Dec 30, 2024
| for i in range(ntodo): | ||
| handle = self._ready.popleft() | ||
| if handle._cancelled: | ||
| if handle.cancelled(): |
Contributor
Author
There was a problem hiding this comment.
This check is redundant because _run checks now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.