8000 gh-135801: Fix inaccurate module info for SyntaxWarnings during AST parsing by heliang666s · Pull Request #135829 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135801: Fix inaccurate module info for SyntaxWarnings during AST parsing #135829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix test_warnings failures in CI
  • Loading branch information
heliang committed Jun 23, 2025
commit 20c4390fb76ba946b706bf056dffc668ed14682b
9 changes: 6 additions & 3 deletions Lib/test/test_warnings/__init__.py
50C8
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,11 @@ def test_improper_input(self):
self.assertRaises(UserWarning, self.module.warn, 'convert to error')

def test_import_from_module(self):
script = support.script_helper.make_script('test_warnings_importer',
'import test.test_warnings.data.import_warning')
rc, out, err = assert_python_ok(script)
with support.temp_dir() as script_dir:
script = support.script_helper.make_script(script_dir,
'test_warnings_importer',
'import test.test_warnings.data.import_warning')
rc, out, err = assert_python_ok(script)
self.assertNotIn(b'UserWarning', err)

def test_syntax_warning_for_compiler(self):
Expand All @@ -794,6 +796,7 @@ def func(self):
self.assertEqual(out, b'')
# Check that we got a SyntaxError.
err = err.decode()
err = support.strip_ansi(err)
self.assertIn("""SyntaxError: "is" with 'int' literal. Did you mean "=="?""", err)
# Check that the filename in the traceback is correct.
self.assertIn(os.path.basename(script_name), err)
Expand Down
Loading
0