Issue #9871: Prevent IDLE 3 crash when given byte stings
with invalid hex escape sequences, like b'\x0'.
(Original patch by Claudiu Popa.)
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index da74729..43e08f2 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -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: