[Python-checkins] CVS: python/dist/src/Python compile.c,2.178,2.179
Guido van Rossum
gvanrossum@users.sourceforge.net
Wed, 28 Feb 2001 14:08:14 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv31798
Modified Files:
compile.c
Log Message:
Let's have some sanity. Introduce a helper to issue a symbol table
warning.
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.178
retrieving revision 2.179
diff -C2 -r2.178 -r2.179
*** compile.c 2001/02/28 21:55:38 2.178
--- compile.c 2001/02/28 22:08:12 2.179
***************
*** 3984,3987 ****
--- 3984,4003 ----
}
+ /* Helper function to issue symbol table warnings */
+
+ static void
+ symtable_warn(struct symtable *st, char *msg)
+ {
+ if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, st->st_filename,
+ st->st_cur->ste_lineno, NULL, NULL) < 0) {
+ if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) {
+ PyErr_SetString(PyExc_SyntaxError, msg);
+ PyErr_SyntaxLocation(st->st_filename,
+ st->st_cur->ste_lineno);
+ }
+ st->st_errors++;
+ }
+ }
+
/* Helper function for setting lineno and filename */
***************
*** 4838,4857 ****
else
sprintf(buf, GLOBAL_AFTER_USE, name);
! if (PyErr_WarnExplicit(PyExc_SyntaxWarning,
! buf, st->st_filename,
! st->st_cur->ste_lineno,
! NULL, NULL) < 0)
! {
! if (PyErr_ExceptionMatches(
! PyExc_SyntaxWarning))
! {
! PyErr_SetString(
! PyExc_SyntaxError, buf);
! PyErr_SyntaxLocation(
! st->st_filename,
! st->st_cur->ste_lineno);
! }
! st->st_errors++;
! }
}
}
--- 4854,4858 ----
else
sprintf(buf, GLOBAL_AFTER_USE, name);
! symtable_warn(st, buf);
}
}