Lines Matching defs:callback

25 init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback)
31 self->wr_callback = Py_XNewRef(callback);
36 new_weakref(PyObject *ob, PyObject *callback)
42 init_weakref(result, ob, callback);
52 * object; it is also responsible for clearing the callback slot.
57 PyObject *callback = self->wr_callback;
75 if (callback != NULL) {
76 Py_DECREF(callback);
82 * the callback intact and uncalled. It must be possible to call self's
84 * state for that to work. We expect tp_dealloc to decref the callback
85 * then. The reason for not letting clear_weakref() decref the callback
86 * right now is that if the callback goes away, that may in turn trigger
87 * another callback (if a weak reference to the callback exists) -- running
95 PyObject *callback;
99 /* Preserve and restore the callback around clear_weakref. */
100 callback = self->wr_callback;
103 self->wr_callback = callback;
227 * two callback-less refs (ref and proxy). Used to determine if the
292 PyObject *ob, *callback = NULL;
294 if (parse_weakref_init_args("__new__", args, kwargs, &ob, &callback)) {
304 if (callback == Py_None)
305 callback = NULL;
308 if (callback == NULL && type == &_PyWeakref_RefType) {
323 init_weakref(self, ob, callback);
324 if (callback == NULL && type == &_PyWeakref_RefType) {
787 PyWeakref_NewRef(PyObject *ob, PyObject *callback)
801 if (callback == Py_None)
802 callback = NULL;
803 if (callback == NULL)
814 result = new_weakref(ob, callback);
817 if (callback == NULL) {
821 /* Someone else added a ref without a callback
846 PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
860 if (callback == Py_None)
861 callback = NULL;
862 if (callback == NULL)
873 result = new_weakref(ob, callback);
884 if (callback == NULL) {
886 /* Someone else added a proxy without a callback
926 handle_callback(PyWeakReference *ref, PyObject *callback)
928 PyObject *cbresult = PyObject_CallOneArg(callback, (PyObject *)ref);
931 PyErr_WriteUnraisable(callback);
955 /* Remove the callback-less basic and proxy references */
968 PyObject *callback = current->wr_callback;
972 if (callback != NULL) {
974 handle_callback(current, callback);
976 Py_DECREF(callback);
1005 PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1);
1008 if (callback != NULL) {
1010 handle_callback((PyWeakReference *)item, callback);