diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2024-08-22 11:55:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 11:55:30 (GMT) |
commit | 3d7b1a526d858496add5b188c790b8d5fe73b06b (patch) | |
tree | c990713e27b5edba168bfb032b4294a625401c3a /Lib/code.py | |
parent | 427b106162c7467de8a84476a053dfba9ef16dfa (diff) | |
download | cpython-3d7b1a526d858496add5b188c790b8d5fe73b06b.zip cpython-3d7b1a526d858496add5b188c790b8d5fe73b06b.tar.gz cpython-3d7b1a526d858496add5b188c790b8d5fe73b06b.tar.bz2 |
gh-122546: use same filename for different exceptions in new repl (#123217)
* gh-122546: use same filename for different exceptions in new repl
* +1
Diffstat (limited to 'Lib/code.py')
-rw-r--r-- | Lib/code.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/code.py b/Lib/code.py index b107982..c559191 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -109,15 +109,7 @@ class InteractiveInterpreter: try: typ, value, tb = sys.exc_info() if filename and typ is SyntaxError: - # Work hard to stuff the correct filename in the exception - try: - msg, (dummy_filename, lineno, offset, line) = value.args - except ValueError: - # Not the format we expect; leave it alone - pass - else: - # Stuff in the right filename - value = SyntaxError(msg, (filename, lineno, offset, line)) + value.filename = filename source = kwargs.pop('source', "") self._showtraceback(typ, value, None, source) finally: |