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
e1c67d1d
Commit
e1c67d1d
authored
May 13, 2002
by
Michael W. Hudson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make StringIO work in --disable-unicode builds...
parent
775c11f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
Lib/StringIO.py
Lib/StringIO.py
+2
-2
Lib/test/test_StringIO.py
Lib/test/test_StringIO.py
+2
-0
No files found.
Lib/StringIO.py
View file @
e1c67d1d
...
...
@@ -39,7 +39,7 @@ __all__ = ["StringIO"]
class
StringIO
:
def
__init__
(
self
,
buf
=
''
):
# Force self.buf to be a string or unicode
if
not
isinstance
(
buf
,
types
.
UnicodeType
):
if
not
isinstance
(
buf
,
types
.
StringTypes
):
buf
=
str
(
buf
)
self
.
buf
=
buf
self
.
len
=
len
(
buf
)
...
...
@@ -138,7 +138,7 @@ class StringIO:
raise
ValueError
,
"I/O operation on closed file"
if
not
s
:
return
# Force s to be a string or unicode
if
not
isinstance
(
s
,
types
.
UnicodeType
):
if
not
isinstance
(
s
,
types
.
StringTypes
):
s
=
str
(
s
)
if
self
.
pos
>
self
.
len
:
self
.
buflist
.
append
(
'
\
0
'
*
(
self
.
pos
-
self
.
len
))
...
...
Lib/test/test_StringIO.py
View file @
e1c67d1d
...
...
@@ -73,6 +73,8 @@ class TestStringIO(TestGenericStringIO):
def
test_unicode
(
self
):
if
not
test_support
.
have_unicode
:
return
# The StringIO module also supports concatenating Unicode
# snippets to larger Unicode strings. This is tested by this
# method. Note that cStringIO does not support this extension.
...
...
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