New submission from STINNER Victor <vstin...@redhat.com>:
The builtin open() function accepts 'U' in the file mode, but it emits a DeprecationWarning since Python 3.4, change made in bpo-15204: commit 6787a3806ee6a85a6f21ede70c10e15a6df267c4 Author: Serhiy Storchaka <storch...@gmail.com> Date: Sat Nov 23 22:12:06 2013 +0200 Issue #15204: Deprecated the 'U' mode in file-like objects. $ cat x.py f = open(__file__, 'U') line = f.readline() print(type(line)) f.close() $ python3.7 x.py x.py:1: DeprecationWarning: 'U' mode is deprecated f = open(__file__, 'U') <class 'str'> The 'U' mode is documented as deprecated since Python 3.3 The flag is basically only there for backward compatibility with Python 2. Python 3.9.0 final release is currently scheduled at 2020-06-08: 6 months after Python 2 end-of-life (2020-01-01). Currently, the 'U' mode is documented as it will be removed from Python 4.0. But I dislike having a bunch of backward incompatible changes in Python 4.0. I would prefer Python 4.0 to be simply the version after Python 3.X. Deprecation warnings are now displayed in the __main__ module by default, thanks to the PEP 565 -- Show DeprecationWarning in __main__. https://www.python.org/dev/peps/pep-0565/ More and more projects run their test suite using -Werror and so have to fix deprecation warnings. ---------- components: Library (Lib) messages: 345991 nosy: serhiy.storchaka, vstinner priority: normal severity: normal status: open title: open(): remove 'U' mode, deprecated since Python 3.3 versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37330> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com