Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a9bd6d5e
Commit
a9bd6d5e
authored
Apr 27, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reject None as the buffering argument like the C implementation does #8546
parent
1dc6b08f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
Doc/library/io.rst
Doc/library/io.rst
+1
-1
Lib/_pyio.py
Lib/_pyio.py
+2
-4
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/io.rst
View file @
a9bd6d5e
...
@@ -61,7 +61,7 @@ Module Interface
...
@@ -61,7 +61,7 @@ Module Interface
classes. :func:`.open` uses the file's blksize (as obtained by
classes. :func:`.open` uses the file's blksize (as obtained by
:func:`os.stat`) if possible.
: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,
Open *file* and return a corresponding stream. If the file cannot be opened,
an :exc:`IOError` is raised.
an :exc:`IOError` is raised.
...
...
Lib/_pyio.py
View file @
a9bd6d5e
...
@@ -40,7 +40,7 @@ class BlockingIOError(IOError):
...
@@ -40,7 +40,7 @@ class BlockingIOError(IOError):
self
.
characters_written
=
characters_written
self
.
characters_written
=
characters_written
def
open
(
file
,
mode
=
"r"
,
buffering
=
None
,
def
open
(
file
,
mode
=
"r"
,
buffering
=
-
1
,
encoding
=
None
,
errors
=
None
,
encoding
=
None
,
errors
=
None
,
newline
=
None
,
closefd
=
True
):
newline
=
None
,
closefd
=
True
):
...
@@ -155,7 +155,7 @@ def open(file, mode="r", buffering=None,
...
@@ -155,7 +155,7 @@ def open(file, mode="r", buffering=None,
raise
TypeError
(
"invalid file: %r"
%
file
)
raise
TypeError
(
"invalid file: %r"
%
file
)
if
not
isinstance
(
mode
,
basestring
):
if
not
isinstance
(
mode
,
basestring
):
raise
TypeError
(
"invalid mode: %r"
%
mode
)
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
)
raise
TypeError
(
"invalid buffering: %r"
%
buffering
)
if
encoding
is
not
None
and
not
isinstance
(
encoding
,
basestring
):
if
encoding
is
not
None
and
not
isinstance
(
encoding
,
basestring
):
raise
TypeError
(
"invalid encoding: %r"
%
encoding
)
raise
TypeError
(
"invalid encoding: %r"
%
encoding
)
...
@@ -192,8 +192,6 @@ def open(file, mode="r", buffering=None,
...
@@ -192,8 +192,6 @@ def open(file, mode="r", buffering=None,
(
appending
and
"a"
or
""
)
+
(
appending
and
"a"
or
""
)
+
(
updating
and
"+"
or
""
),
(
updating
and
"+"
or
""
),
closefd
)
closefd
)
if
buffering
is
None
:
buffering
=
-
1
line_buffering
=
False
line_buffering
=
False
if
buffering
==
1
or
buffering
<
0
and
raw
.
isatty
():
if
buffering
==
1
or
buffering
<
0
and
raw
.
isatty
():
buffering
=
-
1
buffering
=
-
1
...
...
Misc/NEWS
View file @
a9bd6d5e
...
@@ -27,6 +27,8 @@ Core and Builtins
...
@@ -27,6 +27,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #8546: Reject None given as the buffering argument to _pyio.open.
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by
Sridhar Ratnakumar.
Sridhar Ratnakumar.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment