Browse Source

putil: use Py_REFCNT macro instead of directly accessing reference count field

Closes #1197
Aidan Noll 4 years ago
parent
commit
8fbf972f30
1 changed files with 1 additions and 1 deletions
  1. 1 1
      panda/src/putil/bamReader_ext.cxx

+ 1 - 1
panda/src/putil/bamReader_ext.cxx

@@ -79,7 +79,7 @@ static TypedWritable *factory_callback(const FactoryParams &params){
       // If the Python pointer is the last reference to it, make sure that the
       // 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
       // object isn't destroyed.  We do this by calling unref(), which
       // decreases the reference count without destroying the object.
       // decreases the reference count without destroying the object.
-      if (result->ob_refcnt <= 1) {
+      if (Py_REFCNT(result) <= 1) {
         ref_count->unref();
         ref_count->unref();
 
 
         // Tell the Python wrapper object that it shouldn't try to delete the
         // Tell the Python wrapper object that it shouldn't try to delete the