Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:55

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 Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
0031 
0032 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000
0033 PyAPI_FUNC(int) PyWeakref_GetRef(PyObject *ref, PyObject **pobj);
0034 #endif
0035 
0036 
0037 #ifndef Py_LIMITED_API
0038 #  define Py_CPYTHON_WEAKREFOBJECT_H
0039 #  include "cpython/weakrefobject.h"
0040 #  undef Py_CPYTHON_WEAKREFOBJECT_H
0041 #endif
0042 
0043 #ifdef __cplusplus
0044 }
0045 #endif
0046 #endif /* !Py_WEAKREFOBJECT_H */