Function pyo3::gil::register_incref

source ·
pub unsafe fn register_incref(obj: NonNull<PyObject>)
Expand description

Registers a Python object pointer inside the release pool, to have its reference count increased the next time the GIL is acquired in pyo3.

If the GIL is held, the reference count will be increased immediately instead of being queued for later.

§Safety

The object must be an owned Python reference.

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here