@@ -76,12 +76,17 @@ _weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
76
76
}
77
77
78
78
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]*/
82
86
83
87
static PyObject *
84
- weakref_getweakrefs (PyObject * self , PyObject * object )
88
+ _weakref_getweakrefs (PyObject * module , PyObject * object )
89
+ /*[clinic end generated code: output=25c7731d8e011824 input=00c6d0e5d3206693]*/
85
90
{
86
91
PyObject * result = NULL ;
87
92
@@ -107,33 +112,33 @@ weakref_getweakrefs(PyObject *self, PyObject *object)
107
112
}
108
113
109
114
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]*/
114
127
115
128
static 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]*/
117
131
{
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 );
126
133
}
127
134
128
135
129
136
static PyMethodDef
130
137
weakref_functions [] = {
131
138
_WEAKREF_GETWEAKREFCOUNT_METHODDEF
132
139
_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
137
142
{NULL , NULL , 0 , NULL }
138
143
};
139
144
0 commit comments