- Got rid of newmodule.c
[python/dscho.git] / Include / weakrefobject.h
blob6ead22b5157af73ba1f3f7ca0360337fa57607d5
1 /* Weak references objects for Python. */
3 #ifndef Py_WEAKREFOBJECT_H
4 #define Py_WEAKREFOBJECT_H
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
10 typedef struct _PyWeakReference PyWeakReference;
12 struct _PyWeakReference {
13 PyObject_HEAD
14 PyObject *wr_object;
15 PyObject *wr_callback;
16 long hash;
17 PyWeakReference *wr_prev;
18 PyWeakReference *wr_next;
21 extern DL_IMPORT(PyTypeObject) _PyWeakref_RefType;
22 extern DL_IMPORT(PyTypeObject) _PyWeakref_ProxyType;
23 extern DL_IMPORT(PyTypeObject) _PyWeakref_CallableProxyType;
25 #define PyWeakref_CheckRef(op) \
26 ((op)->ob_type == &_PyWeakref_RefType)
27 #define PyWeakref_CheckProxy(op) \
28 (((op)->ob_type == &_PyWeakref_ProxyType) || \
29 ((op)->ob_type == &_PyWeakref_CallableProxyType))
30 #define PyWeakref_Check(op) \
31 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
34 extern DL_IMPORT(PyObject *) PyWeakref_NewRef(PyObject *ob,
35 PyObject *callback);
36 extern DL_IMPORT(PyObject *) PyWeakref_NewProxy(PyObject *ob,
37 PyObject *callback);
38 extern DL_IMPORT(PyObject *) PyWeakref_GetObject(PyObject *ref);
40 extern DL_IMPORT(long) _PyWeakref_GetWeakrefCount(PyWeakReference *head);
42 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object)
45 #ifdef __cplusplus
47 #endif
48 #endif /* !Py_WEAKREFOBJECT_H */