Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 20654:edd9d0b3c47e | 20655:7344687bf2c0 |
|---|---|
| 114 | 114 |
| 115 static PyObject * | 115 static PyObject * |
| 116 sys_excepthook(PyObject* self, PyObject* args) | 116 sys_excepthook(PyObject* self, PyObject* args) |
| 117 { | 117 { |
| 118 PyObject *exc, *value, *tb; | 118 PyObject *exc, *value, *tb; |
| 119 if (!PyArg_ParseTuple(args, "OOO:excepthook", &exc, &value, &tb)) | 119 if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb)) |
| 120 return NULL; | 120 return NULL; |
| 121 PyErr_Display(exc, value, tb); | 121 PyErr_Display(exc, value, tb); |
| 122 Py_INCREF(Py_None); | 122 Py_INCREF(Py_None); |
| 123 return Py_None; | 123 return Py_None; |
| 124 } | 124 } |
| 450 return Py_None; | 450 return Py_None; |
| 451 } | 451 } |
| 452 #endif /* USE_MALLOPT */ | 452 #endif /* USE_MALLOPT */ |
| 453 | 453 |
| 454 static PyObject * | 454 static PyObject * |
| 455 sys_getrefcount(PyObject *self, PyObject *args) | 455 sys_getrefcount(PyObject *self, PyObject *arg) |
| 456 { | 456 { |
| 457 PyObject *arg; | |
| 458 if (!PyArg_ParseTuple(args, "O:getrefcount", &arg)) | |
| 459 return NULL; | |
| 460 return PyInt_FromLong(arg->ob_refcnt); | 457 return PyInt_FromLong(arg->ob_refcnt); |
| 461 } | 458 } |
| 462 | 459 |
| 463 #ifdef Py_TRACE_REFS | 460 #ifdef Py_TRACE_REFS |
| 464 static PyObject * | 461 static PyObject * |
| 552 #endif | 549 #endif |
| 553 #ifdef Py_TRACE_REFS | 550 #ifdef Py_TRACE_REFS |
| 554 {"getobjects", _Py_GetObjects, METH_VARARGS}, | 551 {"getobjects", _Py_GetObjects, METH_VARARGS}, |
| 555 {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, | 552 {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, |
| 556 #endif | 553 #endif |
| 557 {"getrefcount", sys_getrefcount, METH_VARARGS, getrefcount_doc}, | 554 {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, |
| 558 {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, | 555 {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, |
| 559 getrecursionlimit_doc}, | 556 getrecursionlimit_doc}, |
| 560 {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, | 557 {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, |
| 561 #ifdef USE_MALLOPT | 558 #ifdef USE_MALLOPT |
| 562 {"mdebug", sys_mdebug, METH_VARARGS}, | 559 {"mdebug", sys_mdebug, METH_VARARGS}, |
