Back to index

python3.2  3.2.2
Defines | Functions | Variables
weakrefobject.c File Reference
#include "Python.h"
#include "structmember.h"

Go to the source code of this file.

Defines

#define GET_WEAKREFS_LISTPTR(o)   ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o))
#define UNWRAP(o)
#define UNWRAP_I(o)
#define WRAP_UNARY(method, generic)
#define WRAP_BINARY(method, generic)
#define WRAP_TERNARY(method, generic)
#define WRAP_METHOD(method, special)

Functions

Py_ssize_t _PyWeakref_GetWeakrefCount (PyWeakReference *head)
static void init_weakref (PyWeakReference *self, PyObject *ob, PyObject *callback)
static PyWeakReference * new_weakref (PyObject *ob, PyObject *callback)
static void clear_weakref (PyWeakReference *self)
void _PyWeakref_ClearRef (PyWeakReference *self)
static void weakref_dealloc (PyObject *self)
static int gc_traverse (PyWeakReference *self, visitproc visit, void *arg)
static int gc_clear (PyWeakReference *self)
static PyObjectweakref_call (PyWeakReference *self, PyObject *args, PyObject *kw)
static Py_hash_t weakref_hash (PyWeakReference *self)
static PyObjectweakref_repr (PyWeakReference *self)
static PyObjectweakref_richcompare (PyWeakReference *self, PyWeakReference *other, int op)
static void get_basic_refs (PyWeakReference *head, PyWeakReference **refp, PyWeakReference **proxyp)
static void insert_after (PyWeakReference *newref, PyWeakReference *prev)
static void insert_head (PyWeakReference *newref, PyWeakReference **list)
static int parse_weakref_init_args (char *funcname, PyObject *args, PyObject *kwargs, PyObject **obp, PyObject **callbackp)
static PyObjectweakref___new__ (PyTypeObject *type, PyObject *args, PyObject *kwargs)
static int weakref___init__ (PyObject *self, PyObject *args, PyObject *kwargs)
static int proxy_checkref (PyWeakReference *proxy)
static PyObjectproxy_repr (PyWeakReference *proxy)
static int proxy_setattr (PyWeakReference *proxy, PyObject *name, PyObject *value)
static PyObjectproxy_richcompare (PyObject *proxy, PyObject *v, int op)
static int proxy_bool (PyWeakReference *proxy)
static void proxy_dealloc (PyWeakReference *self)
static int proxy_contains (PyWeakReference *proxy, PyObject *value)
static Py_ssize_t proxy_length (PyWeakReference *proxy)
static int proxy_setitem (PyWeakReference *proxy, PyObject *key, PyObject *value)
static PyObjectproxy_iter (PyWeakReference *proxy)
static PyObjectproxy_iternext (PyWeakReference *proxy)
PyObjectPyWeakref_NewRef (PyObject *ob, PyObject *callback)
PyObjectPyWeakref_NewProxy (PyObject *ob, PyObject *callback)
PyObjectPyWeakref_GetObject (PyObject *ref)
static void handle_callback (PyWeakReference *ref, PyObject *callback)
void PyObject_ClearWeakRefs (PyObject *object)

Variables

PyTypeObject _PyWeakref_RefType
static PyMethodDef proxy_methods []
static PyNumberMethods proxy_as_number
static PySequenceMethods proxy_as_sequence
static PyMappingMethods proxy_as_mapping
PyTypeObject _PyWeakref_ProxyType
PyTypeObject _PyWeakref_CallableProxyType

Define Documentation

#define GET_WEAKREFS_LISTPTR (   o)    ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o))

Definition at line 5 of file weakrefobject.c.

#define UNWRAP (   o)
Value:
if (PyWeakref_CheckProxy(o)) { \
            if (!proxy_checkref((PyWeakReference *)o)) \
                return NULL; \
            o = PyWeakref_GET_OBJECT(o); \
        }

Definition at line 396 of file weakrefobject.c.

#define UNWRAP_I (   o)
Value:
if (PyWeakref_CheckProxy(o)) { \
            if (!proxy_checkref((PyWeakReference *)o)) \
                return -1; \
            o = PyWeakref_GET_OBJECT(o); \
        }

Definition at line 403 of file weakrefobject.c.

#define WRAP_BINARY (   method,
  generic 
)
Value:
static PyObject * \
    method(PyObject *x, PyObject *y) { \
        UNWRAP(x); \
        UNWRAP(y); \
        return generic(x, y); \
    }

Definition at line 417 of file weakrefobject.c.

#define WRAP_METHOD (   method,
  special 
)
Value:
static PyObject * \
    method(PyObject *proxy) { \
            UNWRAP(proxy); \
                return PyObject_CallMethod(proxy, special, ""); \
        }

Definition at line 438 of file weakrefobject.c.

#define WRAP_TERNARY (   method,
  generic 
)
Value:
static PyObject * \
    method(PyObject *proxy, PyObject *v, PyObject *w) { \
        UNWRAP(proxy); \
        UNWRAP(v); \
        if (w != NULL) \
            UNWRAP(w); \
        return generic(proxy, v, w); \
    }

Definition at line 428 of file weakrefobject.c.

#define WRAP_UNARY (   method,
  generic 
)
Value:
static PyObject * \
    method(PyObject *proxy) { \
        UNWRAP(proxy); \
        return generic(proxy); \
    }

Definition at line 410 of file weakrefobject.c.


Function Documentation

void _PyWeakref_ClearRef ( PyWeakReference *  self)

Definition at line 90 of file weakrefobject.c.

{
    PyObject *callback;

    assert(self != NULL);
    assert(PyWeakref_Check(self));
    /* Preserve and restore the callback around clear_weakref. */
    callback = self->wr_callback;
    self->wr_callback = NULL;
    clear_weakref(self);
    self->wr_callback = callback;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Py_ssize_t _PyWeakref_GetWeakrefCount ( PyWeakReference *  head)

Definition at line 10 of file weakrefobject.c.

{
    Py_ssize_t count = 0;

    while (head != NULL) {
        ++count;
        head = head->wr_next;
    }
    return count;
}

Here is the caller graph for this function:

static void clear_weakref ( PyWeakReference *  self) [static]

Definition at line 51 of file weakrefobject.c.

{
    PyObject *callback = self->wr_callback;

    if (PyWeakref_GET_OBJECT(self) != Py_None) {
        PyWeakReference **list = GET_WEAKREFS_LISTPTR(
            PyWeakref_GET_OBJECT(self));

        if (*list == self)
            /* If 'self' is the end of the list (and thus self->wr_next == NULL)
               then the weakref list itself (and thus the value of *list) will
               end up being set to NULL. */
            *list = self->wr_next;
        self->wr_object = Py_None;
        if (self->wr_prev != NULL)
            self->wr_prev->wr_next = self->wr_next;
        if (self->wr_next != NULL)
            self->wr_next->wr_prev = self->wr_prev;
        self->wr_prev = NULL;
        self->wr_next = NULL;
    }
    if (callback != NULL) {
        Py_DECREF(callback);
        self->wr_callback = NULL;
    }
}

Here is the caller graph for this function:

static int gc_clear ( PyWeakReference *  self) [static]

Definition at line 121 of file weakrefobject.c.

{
    clear_weakref(self);
    return 0;
}

Here is the call graph for this function:

static int gc_traverse ( PyWeakReference *  self,
visitproc  visit,
void arg 
) [static]

Definition at line 113 of file weakrefobject.c.

{
    Py_VISIT(self->wr_callback);
    return 0;
}
static void get_basic_refs ( PyWeakReference *  head,
PyWeakReference **  refp,
PyWeakReference **  proxyp 
) [static]

Definition at line 212 of file weakrefobject.c.

{
    *refp = NULL;
    *proxyp = NULL;

    if (head != NULL && head->wr_callback == NULL) {
        /* We need to be careful that the "basic refs" aren't
           subclasses of the main types.  That complicates this a
           little. */
        if (PyWeakref_CheckRefExact(head)) {
            *refp = head;
            head = head->wr_next;
        }
        if (head != NULL
            && head->wr_callback == NULL
            && PyWeakref_CheckProxy(head)) {
            *proxyp = head;
            /* head = head->wr_next; */
        }
    }
}

Here is the caller graph for this function:

static void handle_callback ( PyWeakReference *  ref,
PyObject callback 
) [static]

Definition at line 855 of file weakrefobject.c.

{
    PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);

    if (cbresult == NULL)
        PyErr_WriteUnraisable(callback);
    else
        Py_DECREF(cbresult);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_weakref ( PyWeakReference *  self,
PyObject ob,
PyObject callback 
) [static]

Definition at line 23 of file weakrefobject.c.

{
    self->hash = -1;
    self->wr_object = ob;
    Py_XINCREF(callback);
    self->wr_callback = callback;
}

Here is the caller graph for this function:

static void insert_after ( PyWeakReference *  newref,
PyWeakReference *  prev 
) [static]

Definition at line 237 of file weakrefobject.c.

{
    newref->wr_prev = prev;
    newref->wr_next = prev->wr_next;
    if (prev->wr_next != NULL)
        prev->wr_next->wr_prev = newref;
    prev->wr_next = newref;
}

Here is the caller graph for this function:

static void insert_head ( PyWeakReference *  newref,
PyWeakReference **  list 
) [static]

Definition at line 250 of file weakrefobject.c.

{
    PyWeakReference *next = *list;

    newref->wr_prev = NULL;
    newref->wr_next = next;
    if (next != NULL)
        next->wr_prev = newref;
    *list = newref;
}

Here is the caller graph for this function:

static PyWeakReference* new_weakref ( PyObject ob,
PyObject callback 
) [static]

Definition at line 32 of file weakrefobject.c.

{
    PyWeakReference *result;

    result = PyObject_GC_New(PyWeakReference, &_PyWeakref_RefType);
    if (result) {
        init_weakref(result, ob, callback);
        PyObject_GC_Track(result);
    }
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int parse_weakref_init_args ( char *  funcname,
PyObject args,
PyObject kwargs,
PyObject **  obp,
PyObject **  callbackp 
) [static]

Definition at line 262 of file weakrefobject.c.

{
    /* XXX Should check that kwargs == NULL or is empty. */
    return PyArg_UnpackTuple(args, funcname, 1, 2, obp, callbackp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int proxy_bool ( PyWeakReference *  proxy) [static]

Definition at line 515 of file weakrefobject.c.

Here is the call graph for this function:

static int proxy_checkref ( PyWeakReference *  proxy) [static]

Definition at line 381 of file weakrefobject.c.

{
    if (PyWeakref_GET_OBJECT(proxy) == Py_None) {
        PyErr_SetString(PyExc_ReferenceError,
                        "weakly-referenced object no longer exists");
        return 0;
    }
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int proxy_contains ( PyWeakReference *  proxy,
PyObject value 
) [static]

Definition at line 535 of file weakrefobject.c.

{
    if (!proxy_checkref(proxy))
        return -1;
    return PySequence_Contains(PyWeakref_GET_OBJECT(proxy), value);
}

Here is the call graph for this function:

static void proxy_dealloc ( PyWeakReference *  self) [static]

Definition at line 524 of file weakrefobject.c.

{
    if (self->wr_callback != NULL)
        PyObject_GC_UnTrack((PyObject *)self);
    clear_weakref(self);
    PyObject_GC_Del(self);
}

Here is the call graph for this function:

static PyObject* proxy_iter ( PyWeakReference *  proxy) [static]

Definition at line 570 of file weakrefobject.c.

Here is the call graph for this function:

static PyObject* proxy_iternext ( PyWeakReference *  proxy) [static]

Definition at line 578 of file weakrefobject.c.

Here is the call graph for this function:

static Py_ssize_t proxy_length ( PyWeakReference *  proxy) [static]

Definition at line 546 of file weakrefobject.c.

Here is the call graph for this function:

static PyObject* proxy_repr ( PyWeakReference *  proxy) [static]

Definition at line 453 of file weakrefobject.c.

{
    char buf[160];
    PyOS_snprintf(buf, sizeof(buf),
                  "<weakproxy at %p to %.100s at %p>", proxy,
                  Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name,
                  PyWeakref_GET_OBJECT(proxy));
    return PyUnicode_FromString(buf);
}

Here is the call graph for this function:

static PyObject* proxy_richcompare ( PyObject proxy,
PyObject v,
int  op 
) [static]

Definition at line 473 of file weakrefobject.c.

{
    UNWRAP(proxy);
    UNWRAP(v);
    return PyObject_RichCompare(proxy, v, op);
}

Here is the call graph for this function:

static int proxy_setattr ( PyWeakReference *  proxy,
PyObject name,
PyObject value 
) [static]

Definition at line 465 of file weakrefobject.c.

{
    if (!proxy_checkref(proxy))
        return -1;
    return PyObject_SetAttr(PyWeakref_GET_OBJECT(proxy), name, value);
}

Here is the call graph for this function:

static int proxy_setitem ( PyWeakReference *  proxy,
PyObject key,
PyObject value 
) [static]

Definition at line 556 of file weakrefobject.c.

{
    if (!proxy_checkref(proxy))
        return -1;

    if (value == NULL)
        return PyObject_DelItem(PyWeakref_GET_OBJECT(proxy), key);
    else
        return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value);
}

Here is the call graph for this function:

Definition at line 872 of file weakrefobject.c.

{
    PyWeakReference **list;

    if (object == NULL
        || !PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))
        || object->ob_refcnt != 0) {
        PyErr_BadInternalCall();
        return;
    }
    list = GET_WEAKREFS_LISTPTR(object);
    /* Remove the callback-less basic and proxy references */
    if (*list != NULL && (*list)->wr_callback == NULL) {
        clear_weakref(*list);
        if (*list != NULL && (*list)->wr_callback == NULL)
            clear_weakref(*list);
    }
    if (*list != NULL) {
        PyWeakReference *current = *list;
        Py_ssize_t count = _PyWeakref_GetWeakrefCount(current);
        int restore_error = PyErr_Occurred() ? 1 : 0;
        PyObject *err_type, *err_value, *err_tb;

        if (restore_error)
            PyErr_Fetch(&err_type, &err_value, &err_tb);
        if (count == 1) {
            PyObject *callback = current->wr_callback;

            current->wr_callback = NULL;
            clear_weakref(current);
            if (callback != NULL) {
                if (((PyObject *)current)->ob_refcnt > 0)
                    handle_callback(current, callback);
                Py_DECREF(callback);
            }
        }
        else {
            PyObject *tuple;
            Py_ssize_t i = 0;

            tuple = PyTuple_New(count * 2);
            if (tuple == NULL) {
                if (restore_error)
                    PyErr_Fetch(&err_type, &err_value, &err_tb);
                return;
            }

            for (i = 0; i < count; ++i) {
                PyWeakReference *next = current->wr_next;

                if (((PyObject *)current)->ob_refcnt > 0)
                {
                    Py_INCREF(current);
                    PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current);
                    PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback);
                }
                else {
                    Py_DECREF(current->wr_callback);
                }
                current->wr_callback = NULL;
                clear_weakref(current);
                current = next;
            }
            for (i = 0; i < count; ++i) {
                PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1);

                /* The tuple may have slots left to NULL */
                if (callback != NULL) {
                    PyObject *item = PyTuple_GET_ITEM(tuple, i * 2);
                    handle_callback((PyWeakReference *)item, callback);
                }
            }
            Py_DECREF(tuple);
        }
        if (restore_error)
            PyErr_Restore(err_type, err_value, err_tb);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 842 of file weakrefobject.c.

{
    if (ref == NULL || !PyWeakref_Check(ref)) {
        PyErr_BadInternalCall();
        return NULL;
    }
    return PyWeakref_GET_OBJECT(ref);
}

Here is the caller graph for this function:

PyObject* PyWeakref_NewProxy ( PyObject ob,
PyObject callback 
)

Definition at line 778 of file weakrefobject.c.

{
    PyWeakReference *result = NULL;
    PyWeakReference **list;
    PyWeakReference *ref, *proxy;

    if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) {
        PyErr_Format(PyExc_TypeError,
                     "cannot create weak reference to '%s' object",
                     Py_TYPE(ob)->tp_name);
        return NULL;
    }
    list = GET_WEAKREFS_LISTPTR(ob);
    get_basic_refs(*list, &ref, &proxy);
    if (callback == Py_None)
        callback = NULL;
    if (callback == NULL)
        /* attempt to return an existing weak reference if it exists */
        result = proxy;
    if (result != NULL)
        Py_INCREF(result);
    else {
        /* Note: new_weakref() can trigger cyclic GC, so the weakref
           list on ob can be mutated.  This means that the ref and
           proxy pointers we got back earlier may have been collected,
           so we need to compute these values again before we use
           them. */
        result = new_weakref(ob, callback);
        if (result != NULL) {
            PyWeakReference *prev;

            if (PyCallable_Check(ob))
                Py_TYPE(result) = &_PyWeakref_CallableProxyType;
            else
                Py_TYPE(result) = &_PyWeakref_ProxyType;
            get_basic_refs(*list, &ref, &proxy);
            if (callback == NULL) {
                if (proxy != NULL) {
                    /* Someone else added a proxy without a callback
                       during GC.  Return that one instead of this one
                       to avoid violating the invariants of the list
                       of weakrefs for ob. */
                    Py_DECREF(result);
                    Py_INCREF(result = proxy);
                    goto skip_insert;
                }
                prev = ref;
            }
            else
                prev = (proxy == NULL) ? ref : proxy;

            if (prev == NULL)
                insert_head(result, list);
            else
                insert_after(result, prev);
        skip_insert:
            ;
        }
    }
    return (PyObject *) result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject* PyWeakref_NewRef ( PyObject ob,
PyObject callback 
)

Definition at line 719 of file weakrefobject.c.

{
    PyWeakReference *result = NULL;
    PyWeakReference **list;
    PyWeakReference *ref, *proxy;

    if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) {
        PyErr_Format(PyExc_TypeError,
                     "cannot create weak reference to '%s' object",
                     Py_TYPE(ob)->tp_name);
        return NULL;
    }
    list = GET_WEAKREFS_LISTPTR(ob);
    get_basic_refs(*list, &ref, &proxy);
    if (callback == Py_None)
        callback = NULL;
    if (callback == NULL)
        /* return existing weak reference if it exists */
        result = ref;
    if (result != NULL)
        Py_INCREF(result);
    else {
        /* Note: new_weakref() can trigger cyclic GC, so the weakref
           list on ob can be mutated.  This means that the ref and
           proxy pointers we got back earlier may have been collected,
           so we need to compute these values again before we use
           them. */
        result = new_weakref(ob, callback);
        if (result != NULL) {
            get_basic_refs(*list, &ref, &proxy);
            if (callback == NULL) {
                if (ref == NULL)
                    insert_head(result, list);
                else {
                    /* Someone else added a ref without a callback
                       during GC.  Return that one instead of this one
                       to avoid violating the invariants of the list
                       of weakrefs for ob. */
                    Py_DECREF(result);
                    Py_INCREF(ref);
                    result = ref;
                }
            }
            else {
                PyWeakReference *prev;

                prev = (proxy == NULL) ? ref : proxy;
                if (prev == NULL)
                    insert_head(result, list);
                else
                    insert_after(result, prev);
            }
        }
    }
    return (PyObject *) result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int weakref___init__ ( PyObject self,
PyObject args,
PyObject kwargs 
) [static]

Definition at line 324 of file weakrefobject.c.

{
    PyObject *tmp;

    if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp))
        return 0;
    else
        return -1;
}

Here is the call graph for this function:

static PyObject* weakref___new__ ( PyTypeObject type,
PyObject args,
PyObject kwargs 
) [static]

Definition at line 270 of file weakrefobject.c.

{
    PyWeakReference *self = NULL;
    PyObject *ob, *callback = NULL;

    if (parse_weakref_init_args("__new__", args, kwargs, &ob, &callback)) {
        PyWeakReference *ref, *proxy;
        PyWeakReference **list;

        if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) {
            PyErr_Format(PyExc_TypeError,
                         "cannot create weak reference to '%s' object",
                         Py_TYPE(ob)->tp_name);
            return NULL;
        }
        if (callback == Py_None)
            callback = NULL;
        list = GET_WEAKREFS_LISTPTR(ob);
        get_basic_refs(*list, &ref, &proxy);
        if (callback == NULL && type == &_PyWeakref_RefType) {
            if (ref != NULL) {
                /* We can re-use an existing reference. */
                Py_INCREF(ref);
                return (PyObject *)ref;
            }
        }
        /* We have to create a new reference. */
        /* Note: the tp_alloc() can trigger cyclic GC, so the weakref
           list on ob can be mutated.  This means that the ref and
           proxy pointers we got back earlier may have been collected,
           so we need to compute these values again before we use
           them. */
        self = (PyWeakReference *) (type->tp_alloc(type, 0));
        if (self != NULL) {
            init_weakref(self, ob, callback);
            if (callback == NULL && type == &_PyWeakref_RefType) {
                insert_head(self, list);
            }
            else {
                PyWeakReference *prev;

                get_basic_refs(*list, &ref, &proxy);
                prev = (proxy == NULL) ? ref : proxy;
                if (prev == NULL)
                    insert_head(self, list);
                else
                    insert_after(self, prev);
            }
        }
    }
    return (PyObject *)self;
}

Here is the call graph for this function:

static PyObject* weakref_call ( PyWeakReference *  self,
PyObject args,
PyObject kw 
) [static]

Definition at line 129 of file weakrefobject.c.

{
    static char *kwlist[] = {NULL};

    if (PyArg_ParseTupleAndKeywords(args, kw, ":__call__", kwlist)) {
        PyObject *object = PyWeakref_GET_OBJECT(self);
        Py_INCREF(object);
        return (object);
    }
    return NULL;
}

Here is the call graph for this function:

static void weakref_dealloc ( PyObject self) [static]

Definition at line 104 of file weakrefobject.c.

{
    PyObject_GC_UnTrack(self);
    clear_weakref((PyWeakReference *) self);
    Py_TYPE(self)->tp_free(self);
}

Here is the call graph for this function:

static Py_hash_t weakref_hash ( PyWeakReference *  self) [static]

Definition at line 143 of file weakrefobject.c.

{
    if (self->hash != -1)
        return self->hash;
    if (PyWeakref_GET_OBJECT(self) == Py_None) {
        PyErr_SetString(PyExc_TypeError, "weak object has gone away");
        return -1;
    }
    self->hash = PyObject_Hash(PyWeakref_GET_OBJECT(self));
    return self->hash;
}

Here is the call graph for this function:

static PyObject* weakref_repr ( PyWeakReference *  self) [static]

Definition at line 157 of file weakrefobject.c.

{
    char buffer[256];
    if (PyWeakref_GET_OBJECT(self) == Py_None) {
        PyOS_snprintf(buffer, sizeof(buffer), "<weakref at %p; dead>", self);
    }
    else {
        char *name = NULL;
        PyObject *nameobj = PyObject_GetAttrString(PyWeakref_GET_OBJECT(self),
                                                   "__name__");
        if (nameobj == NULL)
                PyErr_Clear();
        else if (PyUnicode_Check(nameobj))
                name = _PyUnicode_AsString(nameobj);
        PyOS_snprintf(buffer, sizeof(buffer),
                      name ? "<weakref at %p; to '%.50s' at %p (%s)>"
                           : "<weakref at %p; to '%.50s' at %p>",
                      self,
                      Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name,
                      PyWeakref_GET_OBJECT(self),
                      name);
        Py_XDECREF(nameobj);
    }
    return PyUnicode_FromString(buffer);
}

Here is the call graph for this function:

static PyObject* weakref_richcompare ( PyWeakReference *  self,
PyWeakReference *  other,
int  op 
) [static]

Definition at line 188 of file weakrefobject.c.

Here is the call graph for this function:


Variable Documentation

Definition at line 651 of file weakrefobject.c.

Definition at line 336 of file weakrefobject.c.

Initial value:

Definition at line 643 of file weakrefobject.c.

Definition at line 595 of file weakrefobject.c.

Initial value:
 {
    (lenfunc)proxy_length,      
    0,                          
    0,                          
    0,                          
    0,                          
    0,                          
    0,                           
    (objobjproc)proxy_contains, 
}

Definition at line 632 of file weakrefobject.c.

Initial value:
 {
        {"__bytes__", (PyCFunction)proxy_bytes, METH_NOARGS},
        {NULL, NULL}
}

Definition at line 589 of file weakrefobject.c.