[Python-checkins] cpython: whatsnew: 'U' mode deprecation (#15204).

r.david.murray python-checkins at python.org
Mon Mar 10 02:35:12 CET 2014


http://hg.python.org/cpython/rev/2d5544afb510
changeset:   89547:2d5544afb510
user:        R David Murray <rdmurray at bitdance.com>
date:        Sun Mar 09 20:33:35 2014 -0400
summary:
  whatsnew: 'U' mode deprecation (#15204).

files:
  Doc/whatsnew/3.4.rst |  14 +++++++++++++-
  1 files changed, 13 insertions(+), 1 deletions(-)


diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -1948,6 +1948,11 @@
 * The :mod:`sysconfig` key ``SO`` is deprecated, it has been replaced by
   ``EXT_SUFFIX``.
 
+* The ``U`` mode accepted by various ``open`` functions is deprecated.
+  In Python3 it does not do anything useful, and should be replaced by
+  appropriate uses of :class:`io.TextIOWrapper` (if needed) and its *newline*
+  argument.
+
 
 Deprecations in the C API
 -------------------------
@@ -2242,7 +2247,14 @@
 
 * Since the *digestmod* argument to the :func:`hmac.new` function will in the
   future have no default, all calls to :func:`hmac.new` should be changed to
-  explicitly specify a *digestmod*. (:issue:`17276`).
+  explicitly specify a *digestmod* (:issue:`17276`).
+
+* Any calls to ``open`` functions that specify ``U`` should be modified.
+  ``U`` is ineffective in Python3 and will eventually raise an error if used.
+  Depending on the function, the equivalent of its old Python2 behavior can be
+  achieved using either a *newline* argument, or if necessary by wrapping the
+  stream in :mod:`~io.TextIOWrapper` to use its *newline* argument
+  (:issue:`15204`).
 
 
 Changes in the C API

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list