Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_weakref_getweakrefcount__doc__, |
| 6 | "getweakrefcount($module, object, /)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Return the number of weak references to \'object\'."); |
| 10 | |
| 11 | #define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \ |
| 12 | {"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__}, |
| 13 | |
| 14 | static Py_ssize_t |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 15 | _weakref_getweakrefcount_impl(PyObject *module, PyObject *object); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 16 | |
| 17 | static PyObject * |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 18 | _weakref_getweakrefcount(PyObject *module, PyObject *object) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 19 | { |
| 20 | PyObject *return_value = NULL; |
| 21 | Py_ssize_t _return_value; |
| 22 | |
| 23 | _return_value = _weakref_getweakrefcount_impl(module, object); |
| 24 | if ((_return_value == -1) && PyErr_Occurred()) |
| 25 | goto exit; |
| 26 | return_value = PyLong_FromSsize_t(_return_value); |
| 27 | |
| 28 | exit: |
| 29 | return return_value; |
| 30 | } |
Serhiy Storchaka | 1a2b24f | 2016-07-07 17:35:15 +0300 | [diff] [blame] | 31 | /*[clinic end generated code: output=d9086c8576d46933 input=a9049054013a1b77]*/ |