[Python-checkins] r80544 - in python/trunk: Doc/library/io.rst Lib/_pyio.py Misc/NEWS
benjamin.peterson
python-checkins at python.org
Tue Apr 27 23:01:54 CEST 2010
Author: benjamin.peterson
Date: Tue Apr 27 23:01:54 2010
New Revision: 80544
Log:
reject None as the buffering argument like the C implementation does #8546
Modified:
python/trunk/Doc/library/io.rst
python/trunk/Lib/_pyio.py
python/trunk/Misc/NEWS
Modified: python/trunk/Doc/library/io.rst
==============================================================================
--- python/trunk/Doc/library/io.rst (original)
+++ python/trunk/Doc/library/io.rst Tue Apr 27 23:01:54 2010
@@ -61,7 +61,7 @@
classes. :func:`.open` uses the file's blksize (as obtained by
:func:`os.stat`) if possible.
-.. function:: open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True)
+.. function:: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)
Open *file* and return a corresponding stream. If the file cannot be opened,
an :exc:`IOError` is raised.
Modified: python/trunk/Lib/_pyio.py
==============================================================================
--- python/trunk/Lib/_pyio.py (original)
+++ python/trunk/Lib/_pyio.py Tue Apr 27 23:01:54 2010
@@ -40,7 +40,7 @@
self.characters_written = characters_written
-def open(file, mode="r", buffering=None,
+def open(file, mode="r", buffering=-1,
encoding=None, errors=None,
newline=None, closefd=True):
@@ -155,7 +155,7 @@
raise TypeError("invalid file: %r" % file)
if not isinstance(mode, basestring):
raise TypeError("invalid mode: %r" % mode)
- if buffering is not None and not isinstance(buffering, (int, long)):
+ if not isinstance(buffering, (int, long)):
raise TypeError("invalid buffering: %r" % buffering)
if encoding is not None and not isinstance(encoding, basestring):
raise TypeError("invalid encoding: %r" % encoding)
@@ -192,8 +192,6 @@
(appending and "a" or "") +
(updating and "+" or ""),
closefd)
- if buffering is None:
- buffering = -1
line_buffering = False
if buffering == 1 or buffering < 0 and raw.isatty():
buffering = -1
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Tue Apr 27 23:01:54 2010
@@ -27,6 +27,8 @@
Library
-------
+- Issue #8546: Reject None given as the buffering argument to _pyio.open.
+
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
Sridhar Ratnakumar.
More information about the Python-checkins
mailing list