[Python-checkins] python/dist/src/Lib/idlelib PyShell.py,1.77,1.78 run.py,1.24,1.25
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sun, 22 Jun 2003 00:52:58 -0700
Update of /cvsroot/python/python/dist/src/Lib/idlelib
In directory sc8-pr-cvs1:/tmp/cvs-serv25987/Lib/idlelib
Modified Files:
PyShell.py run.py
Log Message:
Idlefork patch #682347: convert Unicode strings from readline to
IOBinding.encoding. Also set sys.std{in,out,err}.encoding, for both
the local and the subprocess case.
Index: PyShell.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** PyShell.py 15 Jun 2003 17:38:45 -0000 1.77
--- PyShell.py 22 Jun 2003 07:52:56 -0000 1.78
***************
*** 742,748 ****
self.save_stderr = sys.stderr
self.save_stdin = sys.stdin
! self.stdout = PseudoFile(self, "stdout")
! self.stderr = PseudoFile(self, "stderr")
! self.console = PseudoFile(self, "console")
if not use_subprocess:
sys.stdout = self.stdout
--- 742,749 ----
self.save_stderr = sys.stderr
self.save_stdin = sys.stdin
! import IOBinding
! self.stdout = PseudoFile(self, "stdout", IOBinding.encoding)
! self.stderr = PseudoFile(self, "stderr", IOBinding.encoding)
! self.console = PseudoFile(self, "console", IOBinding.encoding)
if not use_subprocess:
sys.stdout = self.stdout
***************
*** 887,890 ****
--- 888,897 ----
self.reading = save
line = self.text.get("iomark", "end-1c")
+ if isinstance(line, unicode):
+ import IOBinding
+ try:
+ line = line.encode(IOBinding.encoding)
+ except UnicodeError:
+ pass
self.resetoutput()
if self.canceled:
***************
*** 1091,1098 ****
class PseudoFile:
! def __init__(self, shell, tags):
self.shell = shell
self.tags = tags
self.softspace = 0
def write(self, s):
--- 1098,1106 ----
class PseudoFile:
! def __init__(self, shell, tags, encoding=None):
self.shell = shell
self.tags = tags
self.softspace = 0
+ self.encoding = encoding
def write(self, s):
Index: run.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** run.py 14 Jun 2003 03:33:20 -0000 1.24
--- run.py 22 Jun 2003 07:52:56 -0000 1.25
***************
*** 211,214 ****
--- 211,217 ----
sys.stdout = self.get_remote_proxy("stdout")
sys.stderr = self.get_remote_proxy("stderr")
+ import IOBinding
+ sys.stdin.encoding = sys.stdout.encoding = \
+ sys.stderr.encoding = IOBinding.encoding
self.interp = self.get_remote_proxy("interp")
rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)