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
86ec87de
Commit
86ec87de
authored
Feb 13, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11311: StringIO.readline(0) now returns an empty string as all other
file-like objects.
parent
7097627c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
Lib/StringIO.py
Lib/StringIO.py
+1
-1
Lib/test/test_StringIO.py
Lib/test/test_StringIO.py
+2
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/StringIO.py
View file @
86ec87de
...
@@ -158,7 +158,7 @@ class StringIO:
...
@@ -158,7 +158,7 @@ class StringIO:
newpos
=
self
.
len
newpos
=
self
.
len
else
:
else
:
newpos
=
i
+
1
newpos
=
i
+
1
if
length
is
not
None
and
length
>
0
:
if
length
is
not
None
and
length
>
=
0
:
if
self
.
pos
+
length
<
newpos
:
if
self
.
pos
+
length
<
newpos
:
newpos
=
self
.
pos
+
length
newpos
=
self
.
pos
+
length
r
=
self
.
buf
[
self
.
pos
:
newpos
]
r
=
self
.
buf
[
self
.
pos
:
newpos
]
...
...
Lib/test/test_StringIO.py
View file @
86ec87de
...
@@ -28,6 +28,8 @@ class TestGenericStringIO(unittest.TestCase):
...
@@ -28,6 +28,8 @@ class TestGenericStringIO(unittest.TestCase):
eq
=
self
.
assertEqual
eq
=
self
.
assertEqual
self
.
assertRaises
(
TypeError
,
self
.
_fp
.
seek
)
self
.
assertRaises
(
TypeError
,
self
.
_fp
.
seek
)
eq
(
self
.
_fp
.
read
(
10
),
self
.
_line
[:
10
])
eq
(
self
.
_fp
.
read
(
10
),
self
.
_line
[:
10
])
eq
(
self
.
_fp
.
read
(
0
),
''
)
eq
(
self
.
_fp
.
readline
(
0
),
''
)
eq
(
self
.
_fp
.
readline
(),
self
.
_line
[
10
:]
+
'
\
n
'
)
eq
(
self
.
_fp
.
readline
(),
self
.
_line
[
10
:]
+
'
\
n
'
)
eq
(
len
(
self
.
_fp
.
readlines
(
60
)),
2
)
eq
(
len
(
self
.
_fp
.
readlines
(
60
)),
2
)
self
.
_fp
.
seek
(
0
)
self
.
_fp
.
seek
(
0
)
...
...
Misc/NEWS
View file @
86ec87de
...
@@ -205,6 +205,9 @@ Core and Builtins
...
@@ -205,6 +205,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11311: StringIO.readline(0) now returns an empty string as all other
file-like objects.
- Issue #16800: tempfile.gettempdir() no longer left temporary files when
- Issue #16800: tempfile.gettempdir() no longer left temporary files when
the disk is full. Original patch by Amir Szekely.
the disk is full. Original patch by Amir Szekely.
...
...
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