@@ -121,22 +121,6 @@ typedef struct {
121
121
#define _PyVarObject_CAST (op ) ((PyVarObject*)(op))
122
122
#define _PyVarObject_CAST_CONST (op ) ((const PyVarObject*)(op))
123
123
124
- // This is a static version of _PyObject_IsImmortal(), for the sake
125
- // of other static functions, like _Py_SET_REFCNT() and _Py_INCREF().
126
- static inline int _py_is_immortal (PyObject * op )
127
- {
128
- #ifdef Py_IMMORTAL_CONST_REFCOUNTS
129
- #ifndef _PyObject_IMMORTAL_BIT
130
- // This is duplicated as-is from the internal API.
131
- #define _PyObject_IMMORTAL_BIT (1LL << (8 * sizeof(Py_ssize_t) - 4))
132
- #endif
133
- return (op -> ob_refcnt & _PyObject_IMMORTAL_BIT ) != 0 ;
134
- #else
135
- extern int _PyObject_IsImmortal (PyObject * );
136
- return _PyObject_IsImmortal (op );
137
- #endif
138
- }
139
-
140
124
static inline Py_ssize_t _Py_REFCNT (const PyObject * ob ) {
141
125
return ob -> ob_refcnt ;
142
126
}
@@ -156,6 +140,8 @@ static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
156
140
#define Py_IS_TYPE (ob , type ) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
157
141
158
142
143
+ static inline int _py_is_immortal (PyObject * ); // forward
144
+
159
145
static inline void _Py_SET_REFCNT (PyObject * ob , Py_ssize_t refcnt ) {
160
146
if (_py_is_immortal ((PyObject * )ob )) {
161
147
return ;
@@ -708,6 +694,20 @@ times.
708
694
#error "the immortal objects API is not available in the limited API"
709
695
#endif
710
696
697
+ // This is a static version of _PyObject_IsImmortal(), for the sake
698
+ // of other static functions, like _Py_SET_REFCNT() and _Py_INCREF().
699
+ static inline int _py_is_immortal (PyObject * op )
700
+ {
701
+ #ifdef Py_IMMORTAL_CONST_REFCOUNTS
702
+ return (op -> ob_refcnt & _PyObject_IMMORTAL_BIT ) != 0 ;
703
+ #else
704
+ #ifndef _Py_IMMORTAL_OBJECTS
705
+ extern int _PyObject_IsImmortal (PyObject * );
706
+ #endif
707
+ return _PyObject_IsImmortal (op );
708
+ #endif
709
+ }
710
+
711
711
712
712
static inline int
713
713
PyType_HasFeature (PyTypeObject * type , unsigned long feature )
0 commit comments