-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
When a socket/fd is closed, wake up outstanding waiters #460
Conversation
CC @sscherke @smurfix, since I know this bit both of you before. |
Sorry, I mean @sscherfke |
4d09486
to
1a4b961
Compare
Codecov Report
@@ Coverage Diff @@
## master #460 +/- ##
==========================================
- Coverage 99.28% 99.27% -0.02%
==========================================
Files 89 89
Lines 10499 10617 +118
Branches 728 747 +19
==========================================
+ Hits 10424 10540 +116
- Misses 58 59 +1
- Partials 17 18 +1
Continue to review full report at Codecov.
|
I tried your branch and my examples are working now. :-) |
I think the way to do this is to rename So todo list:
|
Hmm. ClosedResourceError, as a subclass of ClosedError, as a subclass of RuntimeError? |
Why not |
@smurfix We already use @sscherfke |
1a4b961
to
329cf9d
Compare
329cf9d
to
9816bdf
Compare
Just pushed a much more complete patch here. Still todo:
This is in a good state to review though. |
9816bdf
to
0c3a8f8
Compare
0c3a8f8
to
7734dbd
Compare
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.
Looks great! A moderate level of scrutiny didn't find any gaps in logic; just one documentation bit for your consideration.
trio/_core/_exceptions.py
Outdated
"""Raised when attempting to use a resource after it has been closed. | ||
|
||
Note that "closed" here means that *your* code closed the resource, | ||
generally by calling a method with a name like ``close`` or ``aclose``. If |
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.
Do you think it's worth also mentioning the "exited a context manager" possibility for why the thing was closed?
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.
Yeah, that's a good idea!
It looks like the new uncovered lines are in the logic for handling |
@Fuyukai raised an interesting question in chat: you might expect This patch doesn't, though. Why not? Well... if you're calling There might be some super-obscure edge cases where this breaks down? But implementing and testing |
@Fuyukai also pointed out that we can always handle further exception name changes as a separate PR. So I think I've now addressed all comments and this is ready to merge. |
@oremanj thanks! |
Still todo:
Fixes gh-36, gh-459