Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
bpo-46771: Implement task cancel requests#31513
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -105,7 +105,7 @@ def __init__(self, coro, *, loop=None, name=None): | ||
| else: | ||
| self._name = str(name) | ||
| self._num_cancels_requested =0 | ||
| self._must_cancel = False | ||
| self._fut_waiter = None | ||
| self._coro = coro | ||
| @@ -202,9 +202,9 @@ def cancel(self, msg=None): | ||
| self._log_traceback = False | ||
| if self.done(): | ||
| return False | ||
| self._num_cancels_requested += 1 | ||
| if self._num_cancels_requested > 1: | ||
| return False | ||
| if self._fut_waiter is not None: | ||
| if self._fut_waiter.cancel(msg=msg): | ||
| # Leave self._fut_waiter; it may be a Task that | ||
| @@ -217,14 +217,12 @@ def cancel(self, msg=None): | ||
| return True | ||
| def cancelling(self): | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Is the Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Hm, do you have a suggestion? I was thinking that it's still usable as a "truthy" value. Usually when you're interested in the cancel count you should call Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I have no good answer. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Note: Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It's used in TaskGroup currently, so if we were to delete it we'd have to rewrite the code there in this same PR. It's also used by Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Deal! | ||
| return self._num_cancels_requested | ||
| def uncancel(self): | ||
| if self._num_cancels_requested > 0: | ||
| self._num_cancels_requested -= 1 | ||
| return self._num_cancels_requested | ||
| def __step(self, exc=None): | ||
| if self.done(): | ||