prevent redundant coercion from Py_UNICODE to a unicode string when the subscript...
[cython.git] / Cython / Includes / cpython / weakref.pxd
1 from cpython.ref cimport PyObject
2
3 cdef extern from "Python.h":
4
5     bint PyWeakref_Check(object ob)
6     # Return true if ob is either a reference or proxy object.
7
8     bint PyWeakref_CheckRef(object ob)
9     # Return true if ob is a reference object.
10
11     bint PyWeakref_CheckProxy(ob)
12     # Return true if *ob* is a proxy object.
13
14     object PyWeakref_NewRef(object ob, object callback)
15     # Return a weak reference object for the object ob.  This will
16     # always return a new reference, but is not guaranteed to create a
17     # new object; an existing reference object may be returned.  The
18     # second parameter, callback, can be a callable object that
19     # receives notification when ob is garbage collected; it should
20     # accept a single parameter, which will be the weak reference
21     # object itself. callback may also be None or NULL.  If ob is not
22     # a weakly-referencable object, or if callback is not callable,
23     # None, or NULL, this will return NULL and raise TypeError.
24
25     object PyWeakref_NewProxy(object ob, object callback)
26     # Return a weak reference proxy object for the object ob.  This
27     # will always return a new reference, but is not guaranteed to
28     # create a new object; an existing proxy object may be returned.
29     # The second parameter, callback, can be a callable object that
30     # receives notification when ob is garbage collected; it should
31     # accept a single parameter, which will be the weak reference
32     # object itself. callback may also be None or NULL.  If ob is not
33     # a weakly-referencable object, or if callback is not callable,
34     # None, or NULL, this will return NULL and raise TypeError.
35
36     PyObject* PyWeakref_GetObject(object ref)
37     # Return the referenced object from a weak reference, ref.  If the
38     # referent is no longer live, returns None.
39
40     PyObject* PyWeakref_GET_OBJECT(object ref)
41     # Similar to PyWeakref_GetObject, but implemented as a macro that
42     # does no error checking.