[Python-checkins] python/dist/src/Lib StringIO.py,1.27,1.28

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
2002年9月17日 11:10:37 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv27758
Modified Files:
	StringIO.py 
Log Message:
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.
Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** StringIO.py	3 Jun 2002 15:58:30 -0000	1.27
--- StringIO.py	17 Sep 2002 18:10:34 -0000	1.28
***************
*** 153,156 ****
--- 153,160 ----
 if not isinstance(s, basestring):
 s = str(s)
+ if self.pos == self.len:
+ self.buflist.append(s)
+ self.len = self.pos = self.pos + len(s)
+ return
 if self.pos > self.len:
 self.buflist.append('0円'*(self.pos - self.len))

AltStyle によって変換されたページ (->オリジナル) /