MCPcopy Create free account
hub / github.com/pybind/pybind11 / ref_count

Function ref_count

include/pybind11/pytypes.h:205–213  ·  view source on GitHub ↗

Return the object's current reference count

Source from the content-addressed store, hash-verified

203
204 /// Return the object's current reference count
205 ssize_t ref_count() const {
206#ifdef PYPY_VERSION
207 // PyPy uses the top few bits for REFCNT_FROM_PYPY & REFCNT_FROM_PYPY_LIGHT
208 // Following pybind11 2.12.1 and older behavior and removing this part
209 return static_cast<ssize_t>(static_cast<int>(Py_REFCNT(derived().ptr())));
210#else
211 return Py_REFCNT(derived().ptr());
212#endif
213 }
214
215 PYBIND11_DEPRECATED("Call py::type::handle_of(h) or py::type::of(h) instead of h.get_type()")
216 handle get_type() const;

Callers

nothing calls this directly

Calls 2

derivedClass · 0.85
ptrMethod · 0.80

Tested by

no test coverage detected