]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
1. Catch TypeError exception when writing to OutputWindow
authorKurt B. Kaiser <kbk@shore.net>
Sun, 12 Aug 2007 01:52:35 +0000 (01:52 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Sun, 12 Aug 2007 01:52:35 +0000 (01:52 +0000)
2. PyShell: shell isn't working due to encoding issues.  Temporarily direct
   exceptions to the terminal.  Also, trap exceptions occurring during write()
   instead of passing.

Checking (2)  in temporarily to aid finding the encoding problem in
IOBinding.py

Lib/idlelib/OutputWindow.py
Lib/idlelib/PyShell.py

index ef155a442e0f293e7dc4e0bae41173f29b420e76..4c07c035e8a8d8dbd63505e8ab941c2fe0f07ca6 100644 (file)
@@ -40,6 +40,8 @@ class OutputWindow(EditorWindow):
         if isinstance(s, str):
             try:
                 s = str(s, IOBinding.encoding)
+            except TypeError:
+                raise
             except UnicodeError:
                 # some other encoding; let Tcl deal with it
                 pass
index bfd659c3362fad188ae735ac2a94d309f018659b..18ed3aa57fe407db867c24eb46d2e9d8b26c231f 100644 (file)
@@ -825,7 +825,7 @@ class PyShell(OutputWindow):
         self.console = PseudoFile(self, "console", IOBinding.encoding)
         if not use_subprocess:
             sys.stdout = self.stdout
-            sys.stderr = self.stderr
+###            sys.stderr = self.stderr # Don't redirect exceptions, pyshell NG
             sys.stdin = self
         #
         self.history = self.History(self.text)
@@ -1214,7 +1214,8 @@ class PyShell(OutputWindow):
             OutputWindow.write(self, s, tags, "iomark")
             self.text.mark_gravity("iomark", "left")
         except:
-            pass
+            raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions
+                           # let's find out what they are and be specific.
         if self.canceled:
             self.canceled = 0
             if not use_subprocess: