[Python-checkins] r59339 - peps/trunk/pep-0000.txt peps/trunk/pep-3116.txt

guido.van.rossum python-checkins at python.org
Wed Dec 5 01:26:25 CET 2007


Author: guido.van.rossum
Date: Wed Dec  5 01:26:25 2007
New Revision: 59339

Modified:
   peps/trunk/pep-0000.txt
   peps/trunk/pep-3116.txt
Log:
Mark PEP 3116 as accepted -- I'm unlikely to change it much now.
Also update it to include the errors argument, which goes hand in hand with
the encoding argument.


Modified: peps/trunk/pep-0000.txt
==============================================================================
--- peps/trunk/pep-0000.txt	(original)
+++ peps/trunk/pep-0000.txt	Wed Dec  5 01:26:25 2007
@@ -77,6 +77,7 @@
  SA  358  The "bytes" Object                           Schemenauer, GvR
  SA 3101  Advanced String Formatting                   Talin
  SA 3106  Revamping dict.keys(), .values() & .items()  GvR
+ SA 3116  New I/O                                      Stutzbach, Verdone, GvR
  SA 3118  Revising the buffer protocol                 Oliphant, Banks
  SA 3119  Introducing Abstract Base Classes            GvR, Talin
  SA 3121  Extension Module Initialization & Finalization  von Löwis
@@ -93,7 +94,6 @@
  S   365  Adding the pkg_resources module              Eby
  S   368  Standard image protocol and class            Mastrodomenico
  S  3108  Standard Library Reorganization              Cannon
- S  3116  New I/O                                      Stutzbach, Verdone, GvR
  S  3134  Exception Chaining and Embedded Tracebacks   Yee
  S  3135  New Super                                    Spealman, Delaney
  S  3141  A Type Hierarchy for Numbers                 Yasskin
@@ -489,7 +489,7 @@
  SF 3113  Removal of Tuple Parameter Unpacking         Cannon
  SF 3114  Renaming iterator.next() to .__next__()      Yee
  SF 3115  Metaclasses in Python 3000                   Talin
- S  3116  New I/O                                      Stutzbach, Verdone, GvR
+ SA 3116  New I/O                                      Stutzbach, Verdone, GvR
  SR 3117  Postfix Type Declarations                    Brandl
  SA 3118  Revising the buffer protocol                 Oliphant, Banks
  SA 3119  Introducing Abstract Base Classes            GvR, Talin

Modified: peps/trunk/pep-3116.txt
==============================================================================
--- peps/trunk/pep-3116.txt	(original)
+++ peps/trunk/pep-3116.txt	Wed Dec  5 01:26:25 2007
@@ -3,7 +3,7 @@
 Version: $Revision$
 Last-Modified: $Date$
 Author: Daniel Stutzbach, Mike Verdone, Guido van Rossum
-Status: Draft
+Status: Accepted
 Type: Standards Track
 Content-Type: text/x-rst
 Created: 26-Feb-2007
@@ -339,7 +339,7 @@
 ``BufferedIOBase`` object.  Its initializer has the following
 signature:
 
-    ``.__init__(self, buffer, encoding=None, newline=None)``
+    ``.__init__(self, buffer, encoding=None, errors=None, newline=None)``
 
         ``buffer`` is a reference to the ``BufferedIOBase`` object to
         be wrapped with the ``TextIOWrapper``.
@@ -349,6 +349,10 @@
         If it is ``None``, then the system's locale setting will be
         used as the default.
 
+        ``errors`` is an optional string indicating error handling.
+        It may be set whenever ``encoding`` may be set.  It defaults
+        to ``'strict'``.
+
         ``newline`` can be ``None``, ``''``, ``'\n'``, ``'\r'``, or
         ``'\r\n'``; all other values are illegal.  It controls the
         handling of line endings.  It works as follows:
@@ -410,8 +414,7 @@
 Unicode encoding/decoding Issues
 --------------------------------
 
-We should allow passing an error-handling argument whenever an
-encoding is accepted, and we should allow changing the error-handling
+We should allow allow changing the encoding and error-handling
 setting later.  The behavior of Text I/O operations in the face of
 Unicode problems and ambiguities (e.g. diacritics, surrogates, invalid
 bytes in an encoding) should be the same as that of the unicode
@@ -455,7 +458,7 @@
 pseudo-code::
 
     def open(filename, mode="r", buffering=None, *, 
-             encoding=None, newline=None):
+             encoding=None, errors=None, newline=None):
         assert isinstance(filename, (str, int))
         assert isinstance(mode, str)
         assert buffering is None or isinstance(buffering, int)
@@ -478,6 +481,8 @@
             raise ValueError("must have exactly one of read/write/append mode")
         if binary and encoding is not None:
             raise ValueError("binary modes doesn't take an encoding arg")
+        if binary and errors is not None:
+            raise ValueError("binary modes doesn't take an errors arg")
         if binary and newline is not None:
             raise ValueError("binary modes doesn't take a newline arg")
         # XXX Need to spec the signature for FileIO()
@@ -501,7 +506,7 @@
         if binary:
             return buffer
         assert text
-        return TextIOWrapper(buffer, encoding, newline)
+        return TextIOWrapper(buffer, encoding, errors, newline)
 
 
 Copyright


More information about the Python-checkins mailing list