Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 20655:7344687bf2c0 legacy-trunk
Convert getrefcount() to METH_O, and sys_excepthook() to use
PyArg_UnpackTuple().
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 24 Oct 2001 20:47:48 +0000 |
| parents | a4d328d50897 |
| children | e4d380f5f297 |
line wrap: on
line diff
--- a/Python/sysmodule.c Wed Oct 24 20:42:55 2001 +0000 +++ b/Python/sysmodule.c Wed Oct 24 20:47:48 2001 +0000 @@ -116,7 +116,7 @@ sys_excepthook(PyObject* self, PyObject* args) { 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; PyErr_Display(exc, value, tb); Py_INCREF(Py_None); @@ -452,11 +452,8 @@ #endif /* USE_MALLOPT */ 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); } @@ -554,7 +551,7 @@ {"getobjects", _Py_GetObjects, METH_VARARGS}, {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, #endif - {"getrefcount", sys_getrefcount, METH_VARARGS, getrefcount_doc}, + {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, getrecursionlimit_doc}, {"_getframe", sys_getframe, METH_VARARGS, getframe_doc},
