diff options
author | devdanzin <74280297+devdanzin@users.noreply.github.com> | 2024-10-27 01:23:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-27 01:23:53 (GMT) |
commit | 44becb8cba677cbfdbcf2f7652277e5e1efc4f20 (patch) | |
tree | aade9bc93fcb4f9e1eb89194f191bae7253ff8ed /Lib/code.py | |
parent | 51b012b2a8093c92ef2c06884f9719657f9b17f7 (diff) | |
download | cpython-44becb8cba677cbfdbcf2f7652277e5e1efc4f20.zip cpython-44becb8cba677cbfdbcf2f7652277e5e1efc4f20.tar.gz cpython-44becb8cba677cbfdbcf2f7652277e5e1efc4f20.tar.bz2 |
gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732)
Diffstat (limited to 'Lib/code.py')
-rw-r--r-- | Lib/code.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/code.py b/Lib/code.py index c7c59ee..1cc2ed8 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -136,7 +136,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 if sys.excepthook is sys.__excepthook__: |