GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.13] gh-122546: Relax SyntaxError check when raising errors on the … · python/cpython@fda8aec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib
    • code.py
    • test/test_pyrepl
      • test_pyrepl.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/code.py‎

Copy file name to clipboardExpand all lines: Lib/code.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def showsyntaxerror(self, filename=None, **kwargs):
110110
colorize = kwargs.pop('colorize', False)
111111
try:
112112
typ, value, tb = sys.exc_info()
113-
if filename and typ is SyntaxError:
113+
if filename and issubclass(typ, SyntaxError):
114114
value.filename = filename
115115
source = kwargs.pop('source', "")
116116
self._showtraceback(typ, value, None, colorize, source)
Collapse file

‎Lib/test/test_pyrepl/test_pyrepl.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_pyrepl/test_pyrepl.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,10 @@ def test_correct_filename_in_syntaxerrors(self):
11091109
self.skipTest("pyrepl not available")
11101110
self.assertIn("SyntaxError: invalid syntax", output)
11111111
self.assertIn("<python-input-0>", output)
1112+
commands = " b\nexit()\n"
1113+
output, exit_code = self.run_repl(commands, env=env)
1114+
self.assertIn("IndentationError: unexpected indent", output)
1115+
self.assertIn("<python-input-0>", output)
11121116

11131117
def run_repl(
11141118
self,

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.