This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Williams
Recipients Mark.Williams, benjamin.peterson, mahmoud, pitrou, stutzbach, xiang.zhang
Date 2015-10-10.08:48:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+TSurB+0CbUZZcc9eU-KKJo1Yf4GKbcYD_o6HZ0kxNPHruKeg@mail.gmail.com>
In-reply-to <1444465632.89.0.824328673782.issue25341@psf.upfronthosting.co.za>
Content
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>
> _______________________________________
>
History
Date User Action Args
2015-10-10 08:48:25Mark.Williamssetrecipients: + Mark.Williams, pitrou, benjamin.peterson, stutzbach, mahmoud, xiang.zhang
2015-10-10 08:48:25Mark.Williamslinkissue25341 messages
2015-10-10 08:48:24Mark.Williamscreate