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
BufferedWriter non-blocking overage #48513
Comments
In some corner cases io.BufferedWriter raises an io.BlockingIOError |
The patch is good. I was first surprised by the fact that e.characters_written is not used I suggest however to add some tests around the first "except def testWriteNonBlockingOverage(self):
raw = MockNonBlockWriterIO((-1, -2))
[...]
|
Thanks for your review, here's a new patch. |
We have discussed this bug in the python developer chat yesterday. I |
I do concur with the desire to restrict changes during RC phase. Do this In this case we could apply the patch to the trunk, and let a future |
Christian, if the patch looks good to you I think now it's a good time |
The tests should be written so as not to rely on internal implementation |
Here is a patch which replaces testWriteNonBlocking with a reasonable |
Thanks for the new implementation of MockNonBlockWriterIO class. It There are some minor things in your patch that I would change. For example: # 1 byte will be written, the rest will be buffered
raw.block_on(b"k")
self.assertEquals(bufio.write(b"jklmn"), 5)
# ...
raw.block_on(b"0") The comment is misleading because in fact no byte is written at raw Your tests can't cover the pre-flush condition because max_buffer_size Unless you'll beat me to it or prove me wrong, I'll update your patch |
It depends on the implementation. A different implementation may use a
But how do you decide when it "has to"? Unless you want to constrain the |
I feel that no matter what implementation algorithm BufferedWriter uses
When a direct or indirect (e.g. on close) flush is called for the file |
If you rewrite the above sentence using the word "statistically", then I Anyway :) Practically, the test does work on both py3k and another |
For completeness' sake I've updated your tests to cover the pre-flush |
This has been cured in the io-c branch. |
This has been fixed in io-c branch. (r70152) |
Looks like the test covering the pre-flush condition is missing. |
2009/3/5 Sever Băneșiu <report@bugs.python.org>:
That test is no longer applicable because max_buffer_size is |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: