-
-
Notifications
You must be signed in to change notification settings - Fork 379
add hazmat.FdStream #1129
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
add hazmat.FdStream #1129
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1129 +/- ##
==========================================
+ Coverage 99.55% 99.55% +<.01%
==========================================
Files 105 105
Lines 12715 12716 +1
Branches 969 970 +1
==========================================
+ Hits 12658 12659 +1
Misses 36 36
Partials 21 21
|
|
I'm trying to think of the reasons why we use
I don't think any of these apply here though? So we should probably expose the type(s) themselves instead of having I also think it's awkward to have separate types for send and receive here... a generic fd supports both So I'm thinking maybe we should merge these together into a single This would mean that on Unix |
I got lost here. If |
|
|
|
I've implemented |
9f08b5e to
b30d1b7
Compare
|
Aside: I believe StapledStream Unfortunately the StapledStream API documentation is referring to those attributes extensively... Do inherited method docs really need to be repeated in derived class? oh, but this: |
|
I would expect that we'd have:
Note that on Unix we use pipes to talk to the child process, and pipes are unidirectional, so |
|
Oh I see, you're defining |
It did make it easy to ensure only one holder when receive and send streams were the same. Any ideas for that given the single-fd FdStream? |
|
If the send and receive streams are the same, then just... Use one |
|
OK-- I think the API is settled. Added tests (from former functions) and docs. I didn't do anything to preemptively check for accidental send_all / receive_some on the wrong mode at runtime. I'm assuming it's fine to defer to the existing OSError handling. |
|
another thing I wasn't quite sure about: in the implementation I've used separate task conflict detectors for send & receive NOTE: please squash on merge |
njsmith
left a comment
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.
A few comments below, getting more nitpicky.
There's also a possible refactoring: the only reason _FdHolder exists is to factor out some common code from PipeSendStream and PipeReceiveStream. Now that we're merging those two classes into one, it's no longer really serving any purpose, and we could merge it back into FdStream.
I'm inclined to keep the separation as it keeps FdStream readable. FdHolder could have its own test. |
Process.stdio documented as Stream rather than StapledStream
|
I made a few trivial wording tweaks, and otherwise looks great! Feel free to merge once CI passes, in case I forget... |
|
Actually, I take that back :-). The coverage report is saying that Which makes sense, because there's nothing in (Side note: it's too bad the tests don't catch this... I guess they're doing The obvious solution would be to make it One option would be to use Another option, which is kind of a silly hack, but I guess would work: at the top of |
|
I'm now manually raising ImportError from |
|
Looks great, waiting for CI now... |
Closes #829.
TODO: