From 3e7be69e1e405e1d5ddd232c69c024ee441592c5 Mon Sep 17 00:00:00 2001 From: Aditya Pillai Date: Mon, 10 Mar 2025 14:19:34 -0400 Subject: [PATCH] Conditionally use Py_REFCNT --- src/converter/from_python.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/converter/from_python.cpp b/src/converter/from_python.cpp index 589d99ef..f3989ba7 100644 --- a/src/converter/from_python.cpp +++ b/src/converter/from_python.cpp @@ -222,7 +222,13 @@ namespace , char const* ref_type) { handle<> holder(source); - if (Py_REFCNT(source) <= 1) + if ( +#if PY_VERSION_HEX < 0x03090000 + source->ob_refcnt +#else + Py_REFCNT(source) +#endif + <= 1) { handle<> msg( #if PY_VERSION_HEX >= 0x3000000