[Python-3000-checkins] r55898 - python/branches/py3k-struni/Python/symtable.c

walter.doerwald python-3000-checkins at python.org
Mon Jun 11 18:06:29 CEST 2007


Author: walter.doerwald
Date: Mon Jun 11 18:06:26 2007
New Revision: 55898

Modified:
   python/branches/py3k-struni/Python/symtable.c
Log:
Simplify error formatting. Fix error message in
check_unoptimized().


Modified: python/branches/py3k-struni/Python/symtable.c
==============================================================================
--- python/branches/py3k-struni/Python/symtable.c	(original)
+++ python/branches/py3k-struni/Python/symtable.c	Mon Jun 11 18:06:26 2007
@@ -385,14 +385,14 @@
 	if (flags & DEF_GLOBAL) {
 		if (flags & DEF_PARAM) {
 			PyErr_Format(PyExc_SyntaxError,
-				     "name '%s' is parameter and global",
-				     PyUnicode_AsString(name));
+			            "name '%U' is parameter and global",
+			            name);
 			return 0;
 		}
                 if (flags & DEF_NONLOCAL) {
 			PyErr_Format(PyExc_SyntaxError,
-				     "name '%s' is nonlocal and global",
-				     PyUnicode_AsString(name));
+			             "name '%U' is nonlocal and global",
+			             name);
 			return 0;
                 }
 		SET_SCOPE(scopes, name, GLOBAL_EXPLICIT);
@@ -405,8 +405,8 @@
         if (flags & DEF_NONLOCAL) {
 		if (flags & DEF_PARAM) {
 			PyErr_Format(PyExc_SyntaxError,
-				     "name '%s' is parameter and nonlocal",
-				     PyUnicode_AsString(name));
+			             "name '%U' is parameter and nonlocal",
+			             name);
 			return 0;
 		}
 		if (!bound) {
@@ -416,8 +416,8 @@
 		}
                 if (!PySet_Contains(bound, name)) {
                         PyErr_Format(PyExc_SyntaxError,
-                                     "no binding for nonlocal '%s' found",
-				     PyUnicode_AsString(name));
+                                     "no binding for nonlocal '%U' found",
+                                     name);
                                      
                         return 0;
                 }
@@ -517,10 +517,10 @@
 	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 '%.100s' "
-			      "because it is %s",
-			      PyUnicode_AsString(ste->ste_name), trailer);
+		PyOS_snprintf(buf, sizeof(buf),
+			      "import * is not allowed in function '%U' "
+			      "because it %s",
+			      ste->ste_name, trailer);
 		break;
 	}
 


More information about the Python-3000-checkins mailing list