[Python-checkins] python/dist/src/Modules cStringIO.c,2.48,2.49

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Sat Aug 21 08:55:46 CEST 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13308/Modules

Modified Files:
	cStringIO.c 
Log Message:
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.


Index: cStringIO.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v
retrieving revision 2.48
retrieving revision 2.49
diff -u -d -r2.48 -r2.49
--- cStringIO.c	27 Jun 2004 17:24:49 -0000	2.48
+++ cStringIO.c	21 Aug 2004 06:55:43 -0000	2.49
@@ -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;



More information about the Python-checkins mailing list