Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:51

0001 /* Weak references objects for Python. */
0002 
0003 #ifndef Py_WEAKREFOBJECT_H
0004 #define Py_WEAKREFOBJECT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008 
0009 typedef struct _PyWeakReference PyWeakReference;
0010 
0011 PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
0012 PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
0013 PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
0014 
0015 #define PyWeakref_CheckRef(op) PyObject_TypeCheck((op), &_PyWeakref_RefType)
0016 #define PyWeakref_CheckRefExact(op) \
0017         Py_IS_TYPE((op), &_PyWeakref_RefType)
0018 #define PyWeakref_CheckProxy(op) \
0019         (Py_IS_TYPE((op), &_PyWeakref_ProxyType) \
0020          || Py_IS_TYPE((op), &_PyWeakref_CallableProxyType))
0021 
0022 #define PyWeakref_Check(op) \
0023         (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
0024 
0025 
0026 PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,
0027                                         PyObject *callback);
0028 PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,
0029                                           PyObject *callback);
0030 PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
0031 
0032 
0033 #ifndef Py_LIMITED_API
0034 #  define Py_CPYTHON_WEAKREFOBJECT_H
0035 #  include "cpython/weakrefobject.h"
0036 #  undef Py_CPYTHON_WEAKREFOBJECT_H
0037 #endif
0038 
0039 #ifdef __cplusplus
0040 }
0041 #endif
0042 #endif /* !Py_WEAKREFOBJECT_H */