[Python-checkins] r80582 - python/branches/py3k/Parser/tokenizer.c
victor.stinner
python-checkins at python.org
Wed Apr 28 19:06:46 CEST 2010
Author: victor.stinner
Date: Wed Apr 28 19:06:46 2010
New Revision: 80582
Log:
Use PyErr_Format() in decoding_fgets()
Avoid a buffer of 500 bytes allocated on the stack.
Modified:
python/branches/py3k/Parser/tokenizer.c
Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c (original)
+++ python/branches/py3k/Parser/tokenizer.c Wed Apr 28 19:06:46 2010
@@ -580,16 +580,14 @@
}
}
if (badchar) {
- char buf[500];
/* Need to add 1 to the line number, since this line
has not been counted, yet. */
- sprintf(buf,
+ PyErr_Format(PyExc_SyntaxError,
"Non-UTF-8 code starting with '\\x%.2x' "
"in file %.200s on line %i, "
"but no encoding declared; "
"see http://python.org/dev/peps/pep-0263/ for details",
badchar, tok->filename, tok->lineno + 1);
- PyErr_SetString(PyExc_SyntaxError, buf);
return error_ret(tok);
}
#endif
More information about the Python-checkins
mailing list