From 16b302c49169aefb4e709cf2ed1d62b301ea3d1f Mon Sep 17 00:00:00 2001 From: Alvaro-Kothe Date: Sun, 16 Nov 2025 12:01:18 -0300 Subject: [PATCH 1/2] fix: implement IsUniqueRefTemp for python<3.14 --- pandas/_libs/internals.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/_libs/internals.pyx b/pandas/_libs/internals.pyx index 43b60b2356b5e..a584d60f7c8a2 100644 --- a/pandas/_libs/internals.pyx +++ b/pandas/_libs/internals.pyx @@ -1006,8 +1006,11 @@ cdef class BlockValuesRefs: cdef extern from "Python.h": """ + // python version < 3.14 #if PY_VERSION_HEX < 0x030E0000 - int __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary(PyObject *ref); + int __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary(PyObject *ref) { + return Py_REFCNT(ref) == 1; + } #else #define __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary \ PyUnstable_Object_IsUniqueReferencedTemporary From 6b4564c28dfb6f1fbd0bbc2f7c4da5518bc48f3e Mon Sep 17 00:00:00 2001 From: Alvaro-Kothe Date: Fri, 21 Nov 2025 19:08:53 -0300 Subject: [PATCH 2/2] chore: comment why function is declared --- pandas/_libs/internals.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/internals.pyx b/pandas/_libs/internals.pyx index a584d60f7c8a2..c651743895995 100644 --- a/pandas/_libs/internals.pyx +++ b/pandas/_libs/internals.pyx @@ -1008,6 +1008,7 @@ cdef extern from "Python.h": """ // python version < 3.14 #if PY_VERSION_HEX < 0x030E0000 + // This function is unused and is declared to avoid a build warning int __Pyx_PyUnstable_Object_IsUniqueReferencedTemporary(PyObject *ref) { return Py_REFCNT(ref) == 1; }