mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Use PyErr_Format() directly instead of
PyOS_snprintf()+PyErr_SetString().
This commit is contained in:
parent
4ddbdad8e7
commit
e42109d79c
1 changed files with 3 additions and 5 deletions
|
@ -517,14 +517,12 @@ check_unoptimized(const PySTEntryObject* ste) {
|
|||
case OPT_TOPLEVEL: /* import * at top-level is fine */
|
||||
return 1;
|
||||
case OPT_IMPORT_STAR:
|
||||
PyOS_snprintf(buf, sizeof(buf),
|
||||
"import * is not allowed in function '%U' "
|
||||
"because it %s",
|
||||
ste->ste_name, trailer);
|
||||
PyErr_Format("import * is not allowed in function '%U' "
|
||||
"because it %s",
|
||||
ste->ste_name, trailer);
|
||||
break;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_SyntaxError, buf);
|
||||
PyErr_SyntaxLocation(ste->ste_table->st_filename,
|
||||
ste->ste_opt_lineno);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue