mirror of https://github.com/python/cpython
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:
commit
86ca04ccc7
|
@ -643,9 +643,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
||||||
text = tkconsole.text
|
text = tkconsole.text
|
||||||
text.tag_remove("ERROR", "1.0", "end")
|
text.tag_remove("ERROR", "1.0", "end")
|
||||||
type, value, tb = sys.exc_info()
|
type, value, tb = sys.exc_info()
|
||||||
msg = value.msg or "<no detail available>"
|
msg = getattr(value, 'msg', '') or value or "<no detail available>"
|
||||||
lineno = value.lineno or 1
|
lineno = getattr(value, 'lineno', '') or 1
|
||||||
offset = value.offset or 0
|
offset = getattr(value, 'offset', '') or 0
|
||||||
if offset == 0:
|
if offset == 0:
|
||||||
lineno += 1 #mark end of offending line
|
lineno += 1 #mark end of offending line
|
||||||
if lineno == 1:
|
if lineno == 1:
|
||||||
|
|
|
@ -101,10 +101,10 @@ class ScriptBinding:
|
||||||
try:
|
try:
|
||||||
# If successful, return the compiled code
|
# If successful, return the compiled code
|
||||||
return compile(source, filename, "exec")
|
return compile(source, filename, "exec")
|
||||||
except (SyntaxError, OverflowError) as value:
|
except (SyntaxError, OverflowError, ValueError) as value:
|
||||||
msg = value.msg or "<no detail available>"
|
msg = getattr(value, 'msg', '') or value or "<no detail available>"
|
||||||
lineno = value.lineno or 1
|
lineno = getattr(value, 'lineno', '') or 1
|
||||||
offset = value.offset or 0
|
offset = getattr(value, 'offset', '') or 0
|
||||||
if offset == 0:
|
if offset == 0:
|
||||||
lineno += 1 #mark end of offending line
|
lineno += 1 #mark end of offending line
|
||||||
pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1)
|
pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1)
|
||||||
|
|
|
@ -753,6 +753,7 @@ Remi Pointel
|
||||||
Guilherme Polo
|
Guilherme Polo
|
||||||
Michael Pomraning
|
Michael Pomraning
|
||||||
Iustin Pop
|
Iustin Pop
|
||||||
|
Claudiu Popa
|
||||||
John Popplewell
|
John Popplewell
|
||||||
Amrit Prem
|
Amrit Prem
|
||||||
Paul Prescod
|
Paul Prescod
|
||||||
|
|
|
@ -274,6 +274,10 @@ Core and Builtins
|
||||||
Library
|
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 #12306: Expose the runtime version of the zlib C library as a constant,
|
- Issue #12306: Expose the runtime version of the zlib C library as a constant,
|
||||||
ZLIB_RUNTIME_VERSION, in the zlib module. Patch by Torsten Landschoff.
|
ZLIB_RUNTIME_VERSION, in the zlib module. Patch by Torsten Landschoff.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue