[Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.12,1.13
Barry Warsaw
python-dev@python.org
Tue, 12 Dec 2000 15:12:26 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.27,1.28 test_audioop.py,1.6,1.7 test_b1.py,1.27,1.28 test_b2.py,1.20,1.21 test_binascii.py,1.6,1.7 test_binhex.py,1.6,1.7 test_bsddb.py,1.4,1.5 test_grammar.py,1.20,1.21 test_math.py,1.9,1.10 test_md5.py,1.3,1.4 test_mmap.py,1.11,1.12 test_new.py,1.5,1.6 test_nis.py,1.8,1.9 test_opcodes.py,1.8,1.9 test_operator.py,1.3,1.4 test_pow.py,1.6,1.7 test_pty.py,1.6,1.7 test_pwd.py,1.7,1.8 test_re.py,1.26,1.27 test_rotor.py,1.4,1.5 test_sax.py,1.13,1.14 test_socket.py,1.14,1.15 test_sre.py,1.13,1.14 test_struct.py,1.6,1.7 test_support.py,1.8,1.9 test_time.py,1.5,1.6 test_types.py,1.18,1.19 test_unpack.py,1.4,1.5
- Next message: [Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.13,1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18874
Modified Files:
StringIO.py
Log Message:
Accept Finn Bock's patch #102208 to hardcode EINVAL to 22 when errno
can't be imported. This makes StringIO.py work with Jython.
Also, get rid of the string module by converting to string methods.
Shorten some lines by using augmented assignment where appropriate.
Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** StringIO.py 2000/10/12 16:45:37 1.12
--- StringIO.py 2000/12/12 23:12:23 1.13
***************
*** 30,36 ****
"""
! import errno
! import string
class StringIO:
def __init__(self, buf = ''):
--- 30,40 ----
"""
! try:
! from errno import EINVAL
! except ImportError:
! EINVAL = 22
+ EMPTYSTRING = ''
+
class StringIO:
def __init__(self, buf = ''):
***************
*** 53,62 ****
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf = self.buf + string.joinfields(self.buflist, '')
self.buflist = []
if mode == 1:
! pos = pos + self.pos
elif mode == 2:
! pos = pos + self.len
self.pos = max(0, pos)
def tell(self):
--- 57,66 ----
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf += EMPTYSTRING.join(self.buflist)
self.buflist = []
if mode == 1:
! pos += self.pos
elif mode == 2:
! pos += self.len
self.pos = max(0, pos)
def tell(self):
***************
*** 68,72 ****
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf = self.buf + string.joinfields(self.buflist, '')
self.buflist = []
if n < 0:
--- 72,76 ----
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf += EMPTYSTRING.join(self.buflist)
self.buflist = []
if n < 0:
***************
*** 81,87 ****
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf = self.buf + string.joinfields(self.buflist, '')
self.buflist = []
! i = string.find(self.buf, '\n', self.pos)
if i < 0:
newpos = self.len
--- 85,91 ----
raise ValueError, "I/O operation on closed file"
if self.buflist:
! self.buf += EMPTYSTRING.join(self.buflist)
self.buflist = []
! i = self.buf.find('\n', self.pos)
if i < 0:
newpos = self.len
***************
*** 111,116 ****
size = self.pos
elif size < 0:
! raise IOError(errno.EINVAL,
! "Negative size not allowed")
elif size < self.pos:
self.pos = size
--- 115,119 ----
size = self.pos
elif size < 0:
! raise IOError(EINVAL, "Negative size not allowed")
elif size < self.pos:
self.pos = size
***************
*** 126,130 ****
if self.pos < self.len:
if self.buflist:
! self.buf = self.buf + string.joinfields(self.buflist, '')
self.buflist = []
self.buflist = [self.buf[:self.pos], s, self.buf[newpos:]]
--- 129,133 ----
if self.pos < self.len:
if self.buflist:
! self.buf += EMPTYSTRING.join(self.buflist)
self.buflist = []
self.buflist = [self.buf[:self.pos], s, self.buf[newpos:]]
***************
*** 137,141 ****
self.pos = newpos
def writelines(self, list):
! self.write(string.joinfields(list, ''))
def flush(self):
if self.closed:
--- 140,144 ----
self.pos = newpos
def writelines(self, list):
! self.write(EMPTYSTRING.join(list))
def flush(self):
if self.closed:
***************
*** 143,147 ****
def getvalue(self):
if self.buflist:
! self.buf = self.buf + string.joinfields(self.buflist, '')
self.buflist = []
return self.buf
--- 146,150 ----
def getvalue(self):
if self.buflist:
! self.buf += EMPTYSTRING.join(self.buflist)
self.buflist = []
return self.buf
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.27,1.28 test_audioop.py,1.6,1.7 test_b1.py,1.27,1.28 test_b2.py,1.20,1.21 test_binascii.py,1.6,1.7 test_binhex.py,1.6,1.7 test_bsddb.py,1.4,1.5 test_grammar.py,1.20,1.21 test_math.py,1.9,1.10 test_md5.py,1.3,1.4 test_mmap.py,1.11,1.12 test_new.py,1.5,1.6 test_nis.py,1.8,1.9 test_opcodes.py,1.8,1.9 test_operator.py,1.3,1.4 test_pow.py,1.6,1.7 test_pty.py,1.6,1.7 test_pwd.py,1.7,1.8 test_re.py,1.26,1.27 test_rotor.py,1.4,1.5 test_sax.py,1.13,1.14 test_socket.py,1.14,1.15 test_sre.py,1.13,1.14 test_struct.py,1.6,1.7 test_support.py,1.8,1.9 test_time.py,1.5,1.6 test_types.py,1.18,1.19 test_unpack.py,1.4,1.5
- Next message: [Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.13,1.14
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]