mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of
PyOS_snprintf().
This commit is contained in:
parent
bfc7bf06a6
commit
499dfcf29d
6 changed files with 54 additions and 68 deletions
|
@ -2138,13 +2138,15 @@ makeuniversal(XMLParserObject* self, const char* string)
|
|||
static void
|
||||
expat_set_error(const char* message, int line, int column)
|
||||
{
|
||||
PyObject *error;
|
||||
PyObject *position;
|
||||
char buffer[256];
|
||||
PyObject *errmsg, *error, *position;
|
||||
|
||||
sprintf(buffer, "%.100s: line %d, column %d", message, line, column);
|
||||
errmsg = PyUnicode_FromFormat("%s: line %d, column %d",
|
||||
message, line, column);
|
||||
if (errmsg == NULL)
|
||||
return;
|
||||
|
||||
error = PyObject_CallFunction(elementtree_parseerror_obj, "s", buffer);
|
||||
error = PyObject_CallFunction(elementtree_parseerror_obj, "O", errmsg);
|
||||
Py_DECREF(errmsg);
|
||||
if (!error)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue