| 1 |
#ifndef Py_INTERNAL_OBJECT_DEFERRED_H |
| 2 |
#define Py_INTERNAL_OBJECT_DEFERRED_H |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
|
| 8 |
#include "pycore_gc.h" |
| 9 |
|
| 10 |
#ifndef Py_BUILD_CORE |
| 11 |
# error "this header requires Py_BUILD_CORE define" |
| 12 |
#endif |
| 13 |
|
| 14 |
// Mark an object as supporting deferred reference counting. This is a no-op |
| 15 |
// in the default (with GIL) build. Objects that use deferred reference |
| 16 |
// counting should be tracked by the GC so that they are eventually collected. |
| 17 |
extern void _PyObject_SetDeferredRefcount(PyObject *op); |
| 18 |
|
| 19 |
static inline int |
| 20 |
_PyObject_HasDeferredRefcount(PyObject *op) |
| 21 |
{ |
| 22 |
#ifdef Py_GIL_DISABLED |
| 23 |
return _PyObject_HAS_GC_BITS(op, _PyGC_BITS_DEFERRED); |
| 24 |
#else |
| 25 |
return 0; |
| 26 |
#endif |
| 27 |
} |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
} |
| 31 |
#endif |
| 32 |
#endif // !Py_INTERNAL_OBJECT_DEFERRED_H |