diff Lib/idlelib/PyShell.py @ 72382:e74860883a9c 3.2

Issue #9871: Prevent IDLE 3 crash when given byte stings with invalid hex escape sequences, like b'\x0'. (Original patch by Claudiu Popa.)
author Ned Deily <nad@acm.org>
date Wed, 14 Sep 2011 14:49:14 -0700
parents fe7777f1ed14
children 9fbf79d6be56
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py	Wed Sep 14 15:14:08 2011 +0200
+++ b/Lib/idlelib/PyShell.py	Wed Sep 14 14:49:14 2011 -0700
@@ -643,9 +643,9 @@
         text = tkconsole.text
         text.tag_remove("ERROR", "1.0", "end")
         type, value, tb = sys.exc_info()
-        msg = value.msg or "<no detail available>"
-        lineno = value.lineno or 1
-        offset = value.offset or 0
+        msg = getattr(value, 'msg', '') or value or "<no detail available>"
+        lineno = getattr(value, 'lineno', '') or 1
+        offset = getattr(value, 'offset', '') or 0
         if offset == 0:
             lineno += 1 #mark end of offending line
         if lineno == 1: