From 8fbf972f306ec44ee6331145f7b60f869ea2ac34 Mon Sep 17 00:00:00 2001 From: Aidan Noll Date: Sat, 16 Oct 2021 00:00:50 -0400 Subject: [PATCH] putil: use Py_REFCNT macro instead of directly accessing reference count field Closes #1197 --- panda/src/putil/bamReader_ext.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/putil/bamReader_ext.cxx b/panda/src/putil/bamReader_ext.cxx index a224a36037..99ec982d74 100644 --- a/panda/src/putil/bamReader_ext.cxx +++ b/panda/src/putil/bamReader_ext.cxx @@ -79,7 +79,7 @@ static TypedWritable *factory_callback(const FactoryParams ¶ms){ // If the Python pointer is the last reference to it, make sure that the // object isn't destroyed. We do this by calling unref(), which // decreases the reference count without destroying the object. - if (result->ob_refcnt <= 1) { + if (Py_REFCNT(result) <= 1) { ref_count->unref(); // Tell the Python wrapper object that it shouldn't try to delete the