Disallow absolute deadlines for relative cancel scopes#3403
Disallow absolute deadlines for relative cancel scopes#3403A5rocks merged 3 commits intopython-trio:mainfrom
Conversation
b97ab8b to
ef54ef3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3403 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19424 19417 -7
Branches 1318 1318
===============================================
- Hits 19424 19417 -7
🚀 New features to boost your workflow:
|
|
I've added a change that allows |
I think this is slightly footgunny: with trio.CancelScope(relative_deadline=7) as cs:
...
# nvm we want delay it 10 seconds
cs.deadline = 10
# oops now we instantly cancelthe properties are so similarly named, that I think it could be easy to mistakenly type one instead of the other, or overlook/get confused when reading the code. And I don't think it's a necessary API since if you really want to "switch type" you can do so explicitly by doing simple math with |
|
I'm not so sure it's that much of a footgun given it's only before we enter the cancel scope, but TBH it's really unnecessary. I guess if people complain, we can think about the right way to do this but I'll just undo those commits. |
0a66eab to
b99abbd
Compare
okay yeah it's def less bad when you can only do it before entering. Forcing them to recreate the scope when changing type seems fair enough though |
This just converts our deprecations into
RuntimeErrors. It's been long enough!