Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Python documentation #1963

Merged
merged 5 commits into from Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/gil.rs
Expand Up @@ -357,6 +357,12 @@ unsafe impl Sync for ReferencePool {}
static POOL: ReferencePool = ReferencePool::new();

/// A RAII pool which PyO3 uses to store owned Python references.
///
/// See the [Memory Management] chapter of the guide for more information about how PyO3 uses
/// [`GILPool`] to manage memory.

///
/// [Memory Management]: https://pyo3.rs/main/memory.html#gil-bound-memory
#[allow(clippy::upper_case_acronyms)]
pub struct GILPool {
/// Initial length of owned objects and anys.
Expand All @@ -366,13 +372,14 @@ pub struct GILPool {
}

impl GILPool {
/// Creates a new `GILPool`. This function should only ever be called with the GIL held.
/// Creates a new [`GILPool`]. This function should only ever be called with the GIL held.
///
/// It is recommended not to use this API directly, but instead to use `Python::new_pool`, as
/// It is recommended not to use this API directly, but instead to use [`Python::new_pool`], as
/// that guarantees the GIL is held.
///
/// # Safety
/// As well as requiring the GIL, see the notes on `Python::new_pool`.
///
/// As well as requiring the GIL, see the safety notes on [`Python::new_pool`].
#[inline]
pub unsafe fn new() -> GILPool {
increment_gil_count();
Expand All @@ -384,7 +391,7 @@ impl GILPool {
}
}

/// Get the Python token associated with this `GILPool`.
/// Gets the Python token associated with this [`GILPool`].
pub fn python(&self) -> Python {
unsafe { Python::assume_gil_acquired() }
}
Expand Down