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
|
|
|
|
2022-06-16 08:49:43 -03:00
|
|
|
#define PyWeakref_CheckRef(op) PyObject_TypeCheck((op), &_PyWeakref_RefType)
|
2004-07-02 15:57:45 -03:00
|
|
|
#define PyWeakref_CheckRefExact(op) \
|
2022-06-16 08:49:43 -03:00
|
|
|
Py_IS_TYPE((op), &_PyWeakref_RefType)
|
2001-10-05 18:52:26 -03:00
|
|
|
#define PyWeakref_CheckProxy(op) \
|
2022-06-16 08:49:43 -03: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);
|
2023-06-26 07:10:53 -03:00
|
|
|
Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);
|
2024-03-20 19:52:23 -03:00
|
|
|
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000
|
2023-06-21 06:40:09 -03:00
|
|
|
PyAPI_FUNC(int) PyWeakref_GetRef(PyObject *ref, PyObject **pobj);
|
2024-03-20 19:52:23 -03:00
|
|
|
#endif
|
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 */
|