Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29751 Modified Files: Tag: release22-maint StringIO.py Log Message: It's merge time! Backport lemburg's checkin of revision 1.20: Restore Python 2.1 StringIO.py behaviour: support concatenating Unicode string snippets to larger Unicode strings. This fix should also go into Python 2.2.1. Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.19 retrieving revision 1.19.12.1 diff -C2 -d -r1.19 -r1.19.12.1 *** StringIO.py 2001/09/24 17:34:52 1.19 --- StringIO.py 2002/01/28 15:00:27 1.19.12.1 *************** *** 29,33 **** - There's a simple test set (see end of this file). """ ! try: from errno import EINVAL --- 29,33 ---- - There's a simple test set (see end of this file). """ ! import types try: from errno import EINVAL *************** *** 39,44 **** class StringIO: def __init__(self, buf = ''): ! # Force self.buf to be a string ! self.buf = str(buf) self.len = len(buf) self.buflist = [] --- 39,46 ---- class StringIO: def __init__(self, buf = ''): ! # Force self.buf to be a string or unicode ! if type(buf) is not types.UnicodeType: ! buf = str(buf) ! self.buf = buf self.len = len(buf) self.buflist = [] *************** *** 136,141 **** raise ValueError, "I/O operation on closed file" if not s: return ! # Force s to be a string ! s = str(s) if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) --- 138,144 ---- raise ValueError, "I/O operation on closed file" if not s: return ! # Force s to be a string or unicode ! if type(s) is not types.UnicodeType: ! s = str(s) if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len))
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4