int _PyObject_SetDict(PyObject *obj, PyObject *value);
+#ifndef Py_GIL_DISABLED
+static inline Py_ALWAYS_INLINE void _Py_INCREF_MORTAL(PyObject *op)
+{
+ assert(!_Py_IsStaticImmortal(op));
+ op->ob_refcnt++;
+ _Py_INCREF_STAT_INC();
+#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
+ if (!_Py_IsImmortal(op)) {
+ _Py_INCREF_IncRefTotal();
+ }
+#endif
+}
+#endif
+
#ifdef __cplusplus
}
#endif
if (_Py_IsImmortal(obj)) {
return (_PyStackRef){ .bits = ((uintptr_t)obj) | Py_TAG_REFCNT};
}
- Py_INCREF_MORTAL(obj);
+ _Py_INCREF_MORTAL(obj);
_PyStackRef ref = (_PyStackRef){ .bits = (uintptr_t)obj };
PyStackRef_CheckValid(ref);
return ref;
_PyStackRef_FromPyObjectNewMortal(PyObject *obj)
{
assert(obj != NULL);
- Py_INCREF_MORTAL(obj);
+ _Py_INCREF_MORTAL(obj);
_PyStackRef ref = (_PyStackRef){ .bits = (uintptr_t)obj };
PyStackRef_CheckValid(ref);
return ref;
/* WARNING: This macro evaluates its argument more than once */
#ifdef _WIN32
#define PyStackRef_DUP(REF) \
- (PyStackRef_RefcountOnObject(REF) ? (Py_INCREF_MORTAL(BITS_TO_PTR(REF)), (REF)) : (REF))
+ (PyStackRef_RefcountOnObject(REF) ? (_Py_INCREF_MORTAL(BITS_TO_PTR(REF)), (REF)) : (REF))
#else
static inline _PyStackRef
PyStackRef_DUP(_PyStackRef ref)
{
assert(!PyStackRef_IsNull(ref));
if (PyStackRef_RefcountOnObject(ref)) {
- Py_INCREF_MORTAL(BITS_TO_PTR(ref));
+ _Py_INCREF_MORTAL(BITS_TO_PTR(ref));
}
return ref;
}
PyAPI_FUNC(void) _Py_IncRef(PyObject *);
PyAPI_FUNC(void) _Py_DecRef(PyObject *);
-#ifndef Py_GIL_DISABLED
-static inline Py_ALWAYS_INLINE void Py_INCREF_MORTAL(PyObject *op)
-{
- assert(!_Py_IsStaticImmortal(op));
- op->ob_refcnt++;
- _Py_INCREF_STAT_INC();
-#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
- if (!_Py_IsImmortal(op)) {
- _Py_INCREF_IncRefTotal();
- }
-#endif
-}
-#endif
-
static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
{
#if defined(Py_LIMITED_API) && (Py_LIMITED_API+0 >= 0x030c0000 || defined(Py_REF_DEBUG))