summaryrefslogtreecommitdiffstats
path: root/Modules/cStringIO.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-21 06:55:43 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-21 06:55:43 (GMT)
commit037b3ee44e7de00b4653d73d4808c0f679a909a7 (patch)
tree88ecf25c35a355258bb869acab244cc1b48b4466 /Modules/cStringIO.c
parent7109b287cf84cebdfa99b2b0a657d55f6e481be7 (diff)
downloadcpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.zip
cpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.tar.gz
cpython-037b3ee44e7de00b4653d73d4808c0f679a909a7.tar.bz2
Patch 1012740: cStringIO's truncate doesn't
truncate() left the stream position unchanged, which meant the "truncated" data didn't go away: >>> io.write('abc') >>> io.truncate(0) >>> io.write('xyz') >>> io.getvalue() 'abcxyz' Patch by Dima Dorfman.
Diffstat (limited to 'Modules/cStringIO.c')
-rw-r--r--Modules/cStringIO.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 7e75879..b7333fd 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -289,6 +289,7 @@ IO_truncate(IOobject *self, PyObject *args) {
if (pos < 0) pos = self->pos;
if (self->string_size > pos) self->string_size = pos;
+ self->pos = self->string_size;
Py_INCREF(Py_None);
return Py_None;