Skip to content

Commit 69c223b

Browse files
author
walter.doerwald
committed
Use PyErr_Format() directly instead of
PyOS_snprintf()+PyErr_SetString(). git-svn-id: http://svn.python.org/projects/python/branches/py3k-struni@55899 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 0021f89 commit 69c223b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

Python/symtable.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,14 +517,12 @@ check_unoptimized(const PySTEntryObject* ste) {
517517
case OPT_TOPLEVEL: /* import * at top-level is fine */
518518
return 1;
519519
case OPT_IMPORT_STAR:
520-
PyOS_snprintf(buf, sizeof(buf),
521-
"import * is not allowed in function '%U' "
522-
"because it %s",
523-
ste->ste_name, trailer);
520+
PyErr_Format("import * is not allowed in function '%U' "
521+
"because it %s",
522+
ste->ste_name, trailer);
524523
break;
525524
}
526525

527-
PyErr_SetString(PyExc_SyntaxError, buf);
528526
PyErr_SyntaxLocation(ste->ste_table->st_filename,
529527
ste->ste_opt_lineno);
530528
return 0;

0 commit comments

Comments
 (0)