[Python-checkins] python/dist/src/Parser tokenizer.c,2.72,2.73
lemburg@users.sourceforge.net
lemburg@users.sourceforge.net
Mon, 17 Feb 2003 10:31:59 -0800
Update of /cvsroot/python/python/dist/src/Parser
In directory sc8-pr-cvs1:/tmp/cvs-serv437/Parser
Modified Files:
tokenizer.c
Log Message:
Add URL for PEP to the source code encoding warning.
Remove the usage of PyErr_WarnExplicit() since this could cause
sensitive information from the source files to appear in e.g.
log files.
Index: tokenizer.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v
retrieving revision 2.72
retrieving revision 2.73
diff -C2 -d -r2.72 -r2.73
*** tokenizer.c 9 Feb 2003 20:38:48 -0000 2.72
--- tokenizer.c 17 Feb 2003 18:31:57 -0000 2.73
***************
*** 463,474 ****
}
if (badchar) {
! char buf[200];
! sprintf(buf, "Non-ASCII character '\\x%.2x', "
! "but no declared encoding", badchar);
/* Need to add 1 to the line number, since this line
has not been counted, yet. */
! PyErr_WarnExplicit(PyExc_DeprecationWarning,
! buf, tok->filename, tok->lineno + 1,
! NULL, NULL);
tok->issued_encoding_warning = 1;
}
--- 463,480 ----
}
if (badchar) {
! char buf[500];
/* Need to add 1 to the line number, since this line
has not been counted, yet. */
! sprintf(buf,
! "Non-ASCII character '\\x%.2x' "
! "in file %.200s on line %i, "
! "but no encoding declared; "
! "see http://www.python.org/peps/pep-0263.html for details",
! badchar, tok->filename, tok->lineno + 1);
! /* We don't use PyErr_WarnExplicit() here because
! printing the line in question to e.g. a log file
! could result in sensitive information being
! exposed. */
! PyErr_Warn(PyExc_DeprecationWarning, buf);
tok->issued_encoding_warning = 1;
}