codekingpro/portable-devtools
115k
1/* Weak references objects for Python. */2 3#ifndef Py_WEAKREFOBJECT_H4#define Py_WEAKREFOBJECT_H5#ifdef __cplusplus6extern "C" {7#endif8 9typedef struct _PyWeakReference PyWeakReference;10 11PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;12PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;13PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;14 15#define PyWeakref_CheckRef(op) PyObject_TypeCheck((op), &_PyWeakref_RefType)16#define PyWeakref_CheckRefExact(op) \17 Py_IS_TYPE((op), &_PyWeakref_RefType)18#define PyWeakref_CheckProxy(op) \19 (Py_IS_TYPE((op), &_PyWeakref_ProxyType) \20 || Py_IS_TYPE((op), &_PyWeakref_CallableProxyType))21 22#define PyWeakref_Check(op) \23 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))24 25 26PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob,27 PyObject *callback);28PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob,29 PyObject *callback);30Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref);31 32#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D000033PyAPI_FUNC(int) PyWeakref_GetRef(PyObject *ref, PyObject **pobj);34#endif35 36 37#ifndef Py_LIMITED_API38# define Py_CPYTHON_WEAKREFOBJECT_H39# include "cpython/weakrefobject.h"40# undef Py_CPYTHON_WEAKREFOBJECT_H41#endif42 43#ifdef __cplusplus44}45#endif46#endif /* !Py_WEAKREFOBJECT_H */47 