2001-10-05 18:52:26 -03:00
|
|
|
/* Weak references objects for Python. */
|
|
|
|
|
|
|
|
#ifndef Py_WEAKREFOBJECT_H
|
|
|
|
#define Py_WEAKREFOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct _PyWeakReference PyWeakReference;
|
|
|
|
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
|
|
|
|
PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
|
|
|
|
PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
|
2001-10-05 18:52:26 -03:00
|
|
|
|
2004-07-02 15:57:45 -03:00
|
|
|
#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType)
|
|
|
|
#define PyWeakref_CheckRefExact(op) \
|
2020-02-13 13:37:17 -04:00
|
|
|
Py_IS_TYPE(op, &_PyWeakref_RefType)
|
2001-10-05 18:52:26 -03:00
|
|
|
#define PyWeakref_CheckProxy(op) \
|
2020-02-13 13:37:17 -04:00
|
|
|
(Py_IS_TYPE(op, &_PyWeakref_ProxyType) || \
|
|
|
|
Py_IS_TYPE(op, &_PyWeakref_CallableProxyType))
|
2004-07-02 15:57:45 -03:00
|
|
|
|
2001-10-05 18:52:26 -03:00
|
|
|
#define PyWeakref_Check(op) \
|
|
|
|
(PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))
|
|
|
|
|
|
|
|
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,
|
2021-10-18 20:31:57 -03:00
|
|
|
PyObject *callback);
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,
|
2021-10-18 20:31:57 -03:00
|
|
|
PyObject *callback);
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
|
2001-10-05 18:52:26 -03:00
|
|
|
|
|
|
|
|
2021-10-18 20:31:57 -03:00
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
# define Py_CPYTHON_WEAKREFOBJECT_H
|
|
|
|
# include "cpython/weakrefobject.h"
|
|
|
|
# undef Py_CPYTHON_WEAKREFOBJECT_H
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2003-11-20 17:21:46 -04:00
|
|
|
|
2001-10-05 18:52:26 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_WEAKREFOBJECT_H */
|