File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -290,8 +290,14 @@ _Py_IsOwnedByCurrentThread(PyObject *ob)
290
290
}
291
291
#endif
292
292
293
+ PyAPI_FUNC (Py_ssize_t ) _Py_GetRefcnt (PyObject * ob );
294
+
293
295
static inline Py_ssize_t Py_REFCNT (PyObject * ob ) {
294
- #if !defined(Py_GIL_DISABLED )
296
+ #if defined(Py_LIMITED_API ) && Py_LIMITED_API + 0 >= 0x030d0000
297
+ // Stable ABI implements Py_SET_REFCNT() as a function call
298
+ // on limited C API version 3.13 and newer.
299
+ return _Py_GetRefcnt (ob );
300
+ #elif !defined(Py_GIL_DISABLED )
295
301
return ob -> ob_refcnt ;
296
302
#else
297
303
uint32_t local = _Py_atomic_load_uint32_relaxed (& ob -> ob_ref_local );
Original file line number Diff line number Diff line change
1
+ In the limited C API version 3.13, the :c:func: `Py_REFCNT ` function is now
2
+ implemented as an opaque function call. Patch by Victor Stinner.
Original file line number Diff line number Diff line change @@ -2932,6 +2932,14 @@ int Py_IsFalse(PyObject *x)
2932
2932
}
2933
2933
2934
2934
2935
+ // Py_REFCNT() implementation for stable ABI
2936
+ Py_ssize_t
2937
+ _Py_GetRefcnt (PyObject * ob )
2938
+ {
2939
+ return Py_REFCNT (ob );
2940
+ }
2941
+
2942
+
2935
2943
// Py_SET_REFCNT() implementation for stable ABI
2936
2944
void
2937
2945
_Py_SetRefcnt (PyObject * ob , Py_ssize_t refcnt )
You can’t perform that action at this time.
0 commit comments