blob: c192e72193f0e2dded181593726ca271c5c1e544 [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);
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 Storchaka2954f832016-07-07 18:20:03 +030032/*[clinic end generated code: output=e1ad587147323e19 input=a9049054013a1b77]*/