@@ -76,12 +76,17 @@ _weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
7676}
7777
7878
79- PyDoc_STRVAR (weakref_getweakrefs__doc__ ,
80- "getweakrefs(object) -- return a list of all weak reference objects\n"
81- "that point to 'object'." );
79+ /*[clinic input]
80+ _weakref.getweakrefs
81+ object: object
82+ /
83+
84+ Return a list of all weak reference objects pointing to 'object'.
85+ [clinic start generated code]*/
8286
8387static PyObject *
84- weakref_getweakrefs (PyObject * self , PyObject * object )
88+ _weakref_getweakrefs (PyObject * module , PyObject * object )
89+ /*[clinic end generated code: output=25c7731d8e011824 input=00c6d0e5d3206693]*/
8590{
8691 PyObject * result = NULL ;
8792
@@ -107,33 +112,33 @@ weakref_getweakrefs(PyObject *self, PyObject *object)
107112}
108113
109114
110- PyDoc_STRVAR (weakref_proxy__doc__ ,
111- "proxy(object[, callback]) -- create a proxy object that weakly\n"
112- "references 'object'. 'callback', if given, is called with a\n"
113- "reference to the proxy when 'object' is about to be finalized." );
115+ /*[clinic input]
116+
117+ _weakref.proxy
118+ object: object
119+ callback: object(c_default="NULL") = None
120+ /
121+
122+ Create a proxy object that weakly references 'object'.
123+
124+ 'callback', if given, is called with a reference to the
125+ proxy when 'object' is about to be finalized.
126+ [clinic start generated code]*/
114127
115128static PyObject *
116- weakref_proxy (PyObject * self , PyObject * args )
129+ _weakref_proxy_impl (PyObject * module , PyObject * object , PyObject * callback )
130+ /*[clinic end generated code: output=d68fa4ad9ea40519 input=4808adf22fd137e7]*/
117131{
118- PyObject * object ;
119- PyObject * callback = NULL ;
120- PyObject * result = NULL ;
121-
122- if (PyArg_UnpackTuple (args , "proxy" , 1 , 2 , & object , & callback )) {
123- result = PyWeakref_NewProxy (object , callback );
124- }
125- return result ;
132+ return PyWeakref_NewProxy (object , callback );
126133}
127134
128135
129136static PyMethodDef
130137weakref_functions [] = {
131138 _WEAKREF_GETWEAKREFCOUNT_METHODDEF
132139 _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF
133- {"getweakrefs" , weakref_getweakrefs , METH_O ,
134- weakref_getweakrefs__doc__ },
135- {"proxy" , weakref_proxy , METH_VARARGS ,
136- weakref_proxy__doc__ },
140+ _WEAKREF_GETWEAKREFS_METHODDEF
141+ _WEAKREF_PROXY_METHODDEF
137142 {NULL , NULL , 0 , NULL }
138143};
139144
0 commit comments