mirror of
https://github.com/python/cpython.git
synced 2025-12-09 10:37:17 +00:00
Convert getrefcount() to METH_O, and sys_excepthook() to use
PyArg_UnpackTuple().
This commit is contained in:
parent
e2ae77b8b8
commit
a768882b00
1 changed files with 3 additions and 6 deletions
|
|
@ -116,7 +116,7 @@ static PyObject *
|
||||||
sys_excepthook(PyObject* self, PyObject* args)
|
sys_excepthook(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
PyObject *exc, *value, *tb;
|
PyObject *exc, *value, *tb;
|
||||||
if (!PyArg_ParseTuple(args, "OOO:excepthook", &exc, &value, &tb))
|
if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb))
|
||||||
return NULL;
|
return NULL;
|
||||||
PyErr_Display(exc, value, tb);
|
PyErr_Display(exc, value, tb);
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
@ -452,11 +452,8 @@ sys_mdebug(PyObject *self, PyObject *args)
|
||||||
#endif /* USE_MALLOPT */
|
#endif /* USE_MALLOPT */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
sys_getrefcount(PyObject *self, PyObject *args)
|
sys_getrefcount(PyObject *self, PyObject *arg)
|
||||||
{
|
{
|
||||||
PyObject *arg;
|
|
||||||
if (!PyArg_ParseTuple(args, "O:getrefcount", &arg))
|
|
||||||
return NULL;
|
|
||||||
return PyInt_FromLong(arg->ob_refcnt);
|
return PyInt_FromLong(arg->ob_refcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -554,7 +551,7 @@ static PyMethodDef sys_methods[] = {
|
||||||
{"getobjects", _Py_GetObjects, METH_VARARGS},
|
{"getobjects", _Py_GetObjects, METH_VARARGS},
|
||||||
{"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS},
|
{"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS},
|
||||||
#endif
|
#endif
|
||||||
{"getrefcount", sys_getrefcount, METH_VARARGS, getrefcount_doc},
|
{"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc},
|
||||||
{"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS,
|
{"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS,
|
||||||
getrecursionlimit_doc},
|
getrecursionlimit_doc},
|
||||||
{"_getframe", sys_getframe, METH_VARARGS, getframe_doc},
|
{"_getframe", sys_getframe, METH_VARARGS, getframe_doc},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue