Updates comments regarding the reference pool that were inaccurate (#4176)

This commit is contained in:
Alex Gaynor 2024-05-11 12:48:38 -04:00 committed by GitHub
parent c5f9001985
commit 57500d9b09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 6 deletions

View File

@ -236,7 +236,7 @@ impl Drop for GILGuard {
type PyObjVec = Vec<NonNull<ffi::PyObject>>; type PyObjVec = Vec<NonNull<ffi::PyObject>>;
#[cfg(not(pyo3_disable_reference_pool))] #[cfg(not(pyo3_disable_reference_pool))]
/// Thread-safe storage for objects which were inc_ref / dec_ref while the GIL was not held. /// Thread-safe storage for objects which were dec_ref while the GIL was not held.
struct ReferencePool { struct ReferencePool {
pending_decrefs: sync::Mutex<PyObjVec>, pending_decrefs: sync::Mutex<PyObjVec>,
} }
@ -422,11 +422,8 @@ impl Drop for GILPool {
} }
} }
/// Registers a Python object pointer inside the release pool, to have its reference count increased /// Increments the reference count of a Python object if the GIL is held. If
/// the next time the GIL is acquired in pyo3. /// the GIL is not held, this function will panic.
///
/// If the GIL is held, the reference count will be increased immediately instead of being queued
/// for later.
/// ///
/// # Safety /// # Safety
/// The object must be an owned Python reference. /// The object must be an owned Python reference.