Skip to content

Conversation

@Tinche
Copy link
Contributor

@TincheTinche commented Feb 20, 2022

Changes:

  • Task._cancel_requested: bool is now Task._num_cancels_requested: int
  • Task.cancelling now returns an int
  • Task.uncancel also returns an int, the number of remaining cancel requests
  • the CancelScope no longer cancels with a nonce
  • the CancelScope uncancels in __exit__, and propagates the CancelError if there are more cancel requests
  • CancelScope.cancelled is now a property
  • added a couple of tests, not final

I have not updated any of the comments or docs yet.

https://bugs.python.org/issue46771

@asvetlovasvetlov changed the title Issue 46771 cancel counts bpo-46771: cancel countsFeb 20, 2022
@TincheTincheforce-pushed the issue-46771-cancel-counts branch from 4526894 to b32bbf9CompareFebruary 20, 2022 23:03
@asvetlov
Copy link
Contributor

I like it!
Please feel free to press 'Merge' when you are ready.

@Tinche
Copy link
ContributorAuthor

@asvetlov this is a competing proposal to using the _COUNTERS dict, so maybe we should discuss this further? This makes the cancel count be on the task, instead of in the dict.

@asvetlov
Copy link
Contributor

I understand.
I have a feeling that your approach is better, it doesn't throw TimeoutError if the task was explicitly cancelled.

@TincheTinche marked this pull request as ready for review February 20, 2022 23:59
@Tinche
Copy link
ContributorAuthor

@asvetlov Cool, but you'll need to merge this :)

@asvetlovasvetlov merged commit a926bf0 into python:issue-46771Feb 21, 2022
@bedevere-bot
Copy link

@asvetlov: Please replace # with GH- in the commit message next time. Thanks!

@asvetlov
Copy link
Contributor

Done. Thanks!

@asvetlovasvetlov deleted the issue-46771-cancel-counts branch February 21, 2022 00:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Tinche@asvetlov@bedevere-bot@the-knights-who-say-ni