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 SyntaxWarning deduplication with pseudo-filenames
  • Loading branch information
heliang committed Jun 23, 2025
commit 4b056295fa6f622434e94c6c472f6ded42b4014f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix warning deduplication regression for SyntaxWarnings with pseudo-filenames (e.g., <stdin>, <string>).
2 changes: 1 addition & 1 deletion Python/_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ normalize_module(PyObject *filename)
PyErr_Clear();
return PyUnicode_FromString("<unknown>");
}

if (PyUnicode_GetLength(module_name) == 0) {
Py_DECREF(module_name);
return PyUnicode_FromString("<unknown>");
Expand Down
Loading
0