blob: b93343b079bd2905243ce34e432b8d3453a63dc1 [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
15_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object);
16
17static PyObject *
18_weakref_getweakrefcount(PyModuleDef *module, PyObject *object)
19{
20 PyObject *return_value = NULL;
21 Py_ssize_t _return_value;
22
23 _return_value = _weakref_getweakrefcount_impl(module, object);
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030024 if ((_return_value == -1) && PyErr_Occurred()) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030025 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030026 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030027 return_value = PyLong_FromSsize_t(_return_value);
28
29exit:
30 return return_value;
31}
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030032/*[clinic end generated code: output=00e317cda5359ea3 input=a9049054013a1b77]*/