[Python-checkins] r56630 - peps/trunk/pep-3116.txt
guido.van.rossum
python-checkins at python.org
Mon Jul 30 20:11:00 CEST 2007
Author: guido.van.rossum
Date: Mon Jul 30 20:11:00 2007
New Revision: 56630
Modified:
peps/trunk/pep-3116.txt
Log:
Add support for newline='\r', for some Mac apps that still write those.
Modified: peps/trunk/pep-3116.txt
==============================================================================
--- peps/trunk/pep-3116.txt (original)
+++ peps/trunk/pep-3116.txt Mon Jul 30 20:11:00 2007
@@ -346,13 +346,16 @@
an encoding to be used for translating between the
byte-representation and character-representation. If it is
``None``, then the system's locale setting will be used as the
- default. ``newline`` can be ``None``, ``'\n'``, or ``'\r\n'``
- (all other values are illegal); it indicates the translation
- for ``'\n'`` characters written. If ``None``, a
+ default. ``newline`` can be ``None``, ``'\n'``, ``'\r'``, or
+ ``'\r\n'`` (all other values are illegal); it indicates the
+ translation for ``'\n'`` characters written. If ``None``, a
system-specific default is chosen, i.e., ``'\r\n'`` on Windows
and ``'\n'`` on Unix/Linux. Setting ``newline='\n'`` on input
means that no CRLF translation is done; lines ending in
- ``'\r\n'`` will be returned as ``'\r\n'``.
+ ``'\r\n'`` will be returned as ``'\r\n'``. (``'\r'`` support
+ is still needed for some OSX applications that produce files
+ using ``'\r'`` line endings; Excel (when exporting to text)
+ and Adobe Illustrator EPS files are the most common examples.
Another implementation, ``StringIO``, creates a file-like ``TextIO``
implementation without an underlying Buffered I/O object. While
@@ -419,7 +422,7 @@
assert isinstance(mode, str)
assert buffering is None or isinstance(buffering, int)
assert encoding is None or isinstance(encoding, str)
- assert newline in (None, "\n", "\r\n")
+ assert newline in (None, "\n", "\r", "\r\n")
modes = set(mode)
if modes - set("arwb+t") or len(mode) > len(modes):
raise ValueError("invalid mode: %r" % mode)
More information about the Python-checkins
mailing list