bpo-20082: fix misbehavior of buffered writes to raw files in append mode#21729
bpo-20082: fix misbehavior of buffered writes to raw files in append mode#21729embray wants to merge 5 commits intopython:mainfrom
Conversation
|
Hmm, this seems to suddenly be causing some failures I didn't expect :/ |
Modules/_io/bufferedio.c
Outdated
There was a problem hiding this comment.
This function should be checked for failure, so it should not return void.
There was a problem hiding this comment.
I'm not so sure. What is its failure state? It either sets self->appending = 1 or self->appending = 0. Neither case represents a failure or success. AFAICT all calls within it check for failure or success and are handled appropriately.
There was a problem hiding this comment.
getattr() can raise an arbitrary exception, for example MemoryError or KeyboardInterrupt. They should not be cleared.
BTW, in 3.13 you can use PyObject_GetOptionalAttr() which automatically silences an AttributeError. It exists under other name as private API in older versions.
PyUnicode_FindChar() also can raise an exception, according to the specification, although it is less likely after getting rid of legacy strings.
|
Resolved all the trivial code style issues. Remaining question is whether I think the issue that was causing test failures is fixed. |
|
Hmm, now the CI systems are all consistently showing a new test failure, but I cannot reproduce it locally even with the exact same test command they're running. Update: I can reproduce them now by configuring |
|
I think this is ready now for the next round of review. Not sure why the Azure pipeline failed but it doesn't seem related. |
|
This PR is stale because it has been open for 30 days with no activity. |
if the raw file is appending there is no reason to attempt to rewind it before flushing
…t have a mode attribute) and ensure that the mode is in fact a string
This is a patch for a bug I apparently wrote many years ago but never converted to a PR.
https://bugs.python.org/issue20082