]> granicus.if.org Git - python/commitdiff
Use PyErr_Format() directly instead of
authorWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 16:08:41 +0000 (16:08 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 16:08:41 +0000 (16:08 +0000)
PyOS_snprintf()+PyErr_SetString().

Python/symtable.c

index 1bb3c89e335883853b9115ecc905296ffa884a0a..cc1a700c1fe6e7df57b7bc504ead67e49ac49438 100644 (file)
@@ -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;