[Python-Dev] Change in file() behavior in 2.5
Michael Hudson
mwh at python.net
Thu Sep 7 16:15:35 CEST 2006
"Michael Urman" <murman at gmail.com> writes:
> Hi folks,
>
> Between 2.4 and 2.5 the behavior of file or open with the mode 'wU'
> has changed. In 2.4 it silently works. in 2.5 it raises a ValueError.
> I can't find any more discussion on it in python-dev than tangential
> mentions in this thread:
> http://mail.python.org/pipermail/python-dev/2006-June/065939.html
>
> It is (buried) in NEWS. First I found:
> Bug #1462152: file() now checks more thoroughly for invalid mode
> strings and removes a possible "U" before passing the mode to the
> C library function.
> Which seems to imply different behavior than the actual entry:
> bug #967182: disallow opening files with 'wU' or 'aU' as specified by PEP
> 278.
>
> I don't see anything in pep278 about a timeline, and wanted to make
> sure that transitioning directly from working to raising an error was
> a desired change.
That it was silently ignored was never intentional; it was a bug and
it was fixed. I don't think having a release with deprecation
warnings and so on is worth it.
> This actually caught a bug in an application I work with, which used
> an explicit 'wU', that will currently stop working when people
> upgrade Python but not our application.
I would hope they wouldn't do that without careful testing anyway.
Cheers,
mwh
--
No. In fact, my eyeballs fell out just from reading this question,
so it's a good thing I can touch-type.
-- John Baez, sci.physics.research
More information about the Python-Dev
mailing list