mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
This commit is contained in:
parent
05bd787c6c
commit
885d457709
15 changed files with 61 additions and 42 deletions
|
|
@ -165,7 +165,7 @@ set_hook(const char * funcname, PyObject **hook_var, PyThreadState **tstate, PyO
|
|||
{
|
||||
PyObject *function = Py_None;
|
||||
char buf[80];
|
||||
sprintf(buf, "|O:set_%.50s", funcname);
|
||||
PyOS_snprintf(buf, sizeof(buf), "|O:set_%.50s", funcname);
|
||||
if (!PyArg_ParseTuple(args, buf, &function))
|
||||
return NULL;
|
||||
if (function == Py_None) {
|
||||
|
|
@ -181,7 +181,9 @@ set_hook(const char * funcname, PyObject **hook_var, PyThreadState **tstate, PyO
|
|||
*tstate = PyThreadState_Get();
|
||||
}
|
||||
else {
|
||||
sprintf(buf, "set_%.50s(func): argument not callable", funcname);
|
||||
PyOS_snprintf(buf, sizeof(buf),
|
||||
"set_%.50s(func): argument not callable",
|
||||
funcname);
|
||||
PyErr_SetString(PyExc_TypeError, buf);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue