44 Commits

Author SHA1 Message Date
Serhiy Storchaka
8d7d6bcc25 Issue #11311: StringIO.readline(0) now returns an empty string as all other
file-like objects.
2013-02-13 12:26:58 +02:00
Benjamin Peterson
4fa68ab10b raise an ValueError in getvalue() on closed StringIO (closes #12161)
Thanks for Catalin Iacob for the patch.
2011-05-26 09:56:41 -05:00
Benjamin Peterson
414721614f make StringIO like other file objects in that readline(-1) has no effect #7348 2009-12-13 17:29:16 +00:00
Antoine Pitrou
e08dd117fa Fix a py3k warning in the StringIO module (exhibited in test_codecencodings_cn) 2009-10-14 18:12:54 +00:00
Andrew M. Kuchling
882680462c [Bug #1622533] Make docstrings raw strings because they contain control characters (\0, \1) 2007-01-05 14:22:17 +00:00
Walter Dörwald
0af5d93d8a SF patch #1359365: file and cStringIO raise a ValueError when next() is called
after calling close(). Change StringIO, so that it behaves the same way.
2006-03-15 08:23:53 +00:00
Raymond Hettinger
6065d32325 SF bug #951915: fix bug in StringIO.truncate - length not changed
(Patch by Armin Rigo.)
2004-12-20 23:51:53 +00:00
Raymond Hettinger
513c8bd6f2 Arghh, checked in wrong draft. Replacing with correct one. 2004-09-23 07:00:47 +00:00
Raymond Hettinger
0336e1fe8c Use local variables in StringIO.write().
Makes it easier on the eyes and a bit more snappy.
2004-09-23 06:43:25 +00:00
Raymond Hettinger
deb4da500b Add missing docstrings. 2004-03-14 07:54:37 +00:00
Raymond Hettinger
6ec099658a SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes
the method suitable for use with generator expressions.
2004-03-08 18:17:31 +00:00
Walter Dörwald
70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Tim Peters
58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Walter Dörwald
c2fcf9bb6b Make the module docstring a raw string, so that the backslash in
"read until end of line ('\n') or EOF" will be treated literally.
Fixes SF bug #860155.
2003-12-15 10:16:09 +00:00
Martin v. Löwis
9e62ff287b Patch #822994: Consolidate tests for self.closed. 2003-10-18 10:20:42 +00:00
Guido van Rossum
c1265bd9a6 Make StringIO its own iterator, similar to real files.
(This should also be done to cStringIO.)
2003-01-31 16:04:15 +00:00
Fred Drake
d679e09970 write(): Special case the common situation of a stream that's only
being used to dump output (no seeks), so we can avoid a lot
          of extra checks being made.
2002-09-17 18:10:34 +00:00
Walter Dörwald
65230a2de7 Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)

Do not mention the string module in the rlcompleter docstring.

This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
2002-06-03 15:58:32 +00:00
Tim Peters
8ac1495a6a Whitespace normalization. 2002-05-23 15:15:30 +00:00
Raymond Hettinger
d1fa3db52d Added docstrings excerpted from Python Library Reference.
Closes patch 556161.
2002-05-15 02:56:03 +00:00
Michael W. Hudson
e1c67d1dc0 Make StringIO work in --disable-unicode builds... 2002-05-13 09:42:16 +00:00
Jeremy Hylton
e037665f99 Use isinstance() in preference to comparison of type by is. 2002-05-10 21:00:35 +00:00
Guido van Rossum
8ca162f417 Partial introduction of bools where appropriate. 2002-04-07 06:36:23 +00:00
Neal Norwitz
9fb289d826 SF #515000, print result of f.tell() in test() instead of ignoring 2002-02-11 17:52:18 +00:00
Marc-André Lemburg
f853be980e Restore Python 2.1 StringIO.py behaviour: support concatenating
Unicode string snippets to larger Unicode strings.

This fix should also go into Python 2.2.1.
2002-01-06 17:15:05 +00:00