blob: b83b33e4a18efdebe4beab345c5fb62acb64b689 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_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
14static Py_ssize_t
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030015_weakref_getweakrefcount_impl(PyObject *module, PyObject *object);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030016
17static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030018_weakref_getweakrefcount(PyObject *module, PyObject *object)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030019{
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
28exit:
29 return return_value;
30}
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030031/*[clinic end generated code: output=d9086c8576d46933 input=a9049054013a1b77]*/