Return the object's current reference count
| 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; |