[Python-Dev] Change in file() behavior in 2.5

Michael Urman murman at gmail.com
Thu Sep 7 15:37:41 CEST 2006


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. 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.

Thanks,
Michael
-- 
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-Dev mailing list