diff --git a/c-ext/backend_c.c b/c-ext/backend_c.c index aabe30bc..8f4dd1a4 100644 --- a/c-ext/backend_c.c +++ b/c-ext/backend_c.c @@ -313,7 +313,7 @@ size_t roundpow2(size_t i) { int safe_pybytes_resize(PyObject **obj, Py_ssize_t size) { PyObject *tmp; - if ((*obj)->ob_refcnt == 1) { + if (Py_REFCNT(obj) == 1) { return _PyBytes_Resize(obj, size); }