mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
include filename and line number in SyntaxError
This commit is contained in:
parent
721b1457a0
commit
0847332716
2 changed files with 4 additions and 1 deletions
|
@ -373,6 +373,9 @@ analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags,
|
|||
PyErr_Format(PyExc_SyntaxError,
|
||||
"name '%s' is local and global",
|
||||
PyString_AS_STRING(name));
|
||||
PyErr_SyntaxLocation(ste->ste_table->st_filename,
|
||||
ste->ste_lineno);
|
||||
|
||||
return 0;
|
||||
}
|
||||
SET_SCOPE(dict, name, GLOBAL_EXPLICIT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue