mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
[3.13] gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732) (#126023)
gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732)
(cherry picked from commit 44becb8cba
)
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
This commit is contained in:
parent
b1051577de
commit
fd48d98df9
4 changed files with 17 additions and 1 deletions
|
@ -137,7 +137,8 @@ class InteractiveInterpreter:
|
|||
# Set the line of text that the exception refers to
|
||||
lines = source.splitlines()
|
||||
if (source and typ is SyntaxError
|
||||
and not value.text and len(lines) >= value.lineno):
|
||||
and not value.text and value.lineno is not None
|
||||
and len(lines) >= value.lineno):
|
||||
value.text = lines[value.lineno - 1]
|
||||
sys.last_exc = sys.last_value = value = value.with_traceback(tb)
|
||||
if sys.excepthook is sys.__excepthook__:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue