Message252697
Python's test suite may test the current behavior but that does not lessen
the problem.
I gave an example of apparently correct code that fails (that was actually
encountered by a Python user) in my original description. Another such
example: you cannot duplicate a file object -- same path, same mode --- and
be sure that the duplicate is a true duplicate. Data corruption could
occur in application code if the duplicated file were opened "rb+" instead
of "wb+", as the duplicate would not truncate existing data.
Another way to think about the problem is accuracy of intent. The mode
attribute on file objects can be incorrect, and by "incorrect" I mean "not
describe the mode under which the file was opened." Why have a mode
attribute at all, then? I, for one, would prefer *no* mode attribute to
one that's sometimes incorrect. But a correct one is even better!
On Sat, Oct 10, 2015 at 1:27 AM, Xiang Zhang <report@bugs.python.org> wrote:
>
> Xiang Zhang added the comment:
>
> I think Mark is right. Since wb+ and rb+ have different behaviours they
> should be treat separately.
>
> But this behaviour treating wb+ and rb+ as the same is well tested and
> seems to intended to do so.
>
> ----------
> nosy: +xiang.zhang
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue25341>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2015-10-10 08:48:25 | Mark.Williams | set | recipients:
+ Mark.Williams, pitrou, benjamin.peterson, stutzbach, mahmoud, xiang.zhang |
2015-10-10 08:48:25 | Mark.Williams | link | issue25341 messages |
2015-10-10 08:48:24 | Mark.Williams | create | |
|