diff Modules/cStringIO.c @ 33213:db1bafa9b656 legacy-trunk

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.
author Tim Peters <tim.peters@gmail.com>
date Sat, 21 Aug 2004 06:55:43 +0000
parents 64534fb3afcd
children e0a9f66b7014 774bf9a38b2a
line wrap: on
line diff
--- a/Modules/cStringIO.c	Fri Aug 20 23:13:26 2004 +0000
+++ b/Modules/cStringIO.c	Sat Aug 21 06:55:43 2004 +0000
@@ -289,6 +289,7 @@
         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;