mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
Issue #9871: Prevent IDLE 3 crash when given byte stings
with invalid hex escape sequences, like b'\x0'. (Original patch by Claudiu Popa.)
This commit is contained in:
parent
962055d3c6
commit
79746426c4
@ -643,9 +643,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||
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:
|
||||
|
@ -101,10 +101,10 @@ class ScriptBinding:
|
||||
try:
|
||||
# If successful, return the compiled code
|
||||
return compile(source, filename, "exec")
|
||||
except (SyntaxError, OverflowError) as value:
|
||||
msg = value.msg or "<no detail available>"
|
||||
lineno = value.lineno or 1
|
||||
offset = value.offset or 0
|
||||
except (SyntaxError, OverflowError, ValueError) as value:
|
||||
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
|
||||
pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1)
|
||||
|
@ -705,6 +705,7 @@ Jean-François Piéronne
|
||||
Guilherme Polo
|
||||
Michael Pomraning
|
||||
Iustin Pop
|
||||
Claudiu Popa
|
||||
John Popplewell
|
||||
Amrit Prem
|
||||
Paul Prescod
|
||||
|
@ -25,6 +25,10 @@ Core and Builtins
|
||||
Library
|
||||
-------
|
||||
|
||||
- Issue #9871: Prevent IDLE 3 crash when given byte stings
|
||||
with invalid hex escape sequences, like b'\x0'.
|
||||
(Original patch by Claudiu Popa.)
|
||||
|
||||
- Issue #8933: distutils' PKG-INFO files will now correctly report
|
||||
Metadata-Version: 1.1 instead of 1.0 if a Classifier or Download-URL field is
|
||||
present.
|
||||
|
Loading…
Reference in New Issue
Block a user