Skip to main content

Module state

Module state 

Source
Expand description

Interaction with attachment of the current thread to the Python interpreter.

Re-exportsยง

use crate::Py; ๐Ÿ”’
use crate::PyAny; ๐Ÿ”’
use crate::Python; ๐Ÿ”’
use crate::ffi; ๐Ÿ”’
use crate::platform::sync::nonpoison::Mutex; ๐Ÿ”’ Non-pyo3_disable_reference_pool
use core::cell::Cell; ๐Ÿ”’
use core::mem; ๐Ÿ”’
use core::sync::atomic::AtomicBool; ๐Ÿ”’ Non-pyo3_disable_reference_pool
use core::sync::atomic::Ordering; ๐Ÿ”’ Non-pyo3_disable_reference_pool
use crate::platform::prelude::*; ๐Ÿ”’

Structsยง

ForbidAttaching ๐Ÿ”’
Used to lock safe access to the interpreter
ReferencePool ๐Ÿ”’ Non-pyo3_disable_reference_pool
Thread-safe storage for objects which were dec_ref while not attached.
SuspendAttach ๐Ÿ”’
A guard which can be used to temporarily detach from the interpreter and restore on Drop.

Enumsยง

AttachError ๐Ÿ”’
Possible error when calling try_attach()
AttachGuard ๐Ÿ”’
RAII type that represents thread attachment to the interpreter.

Constantsยง

ATTACH_COUNT ๐Ÿ”’
This is an internal counter in pyo3 monitoring whether this thread is attached to the interpreter.
ATTACH_FORBIDDEN_DURING_TRAVERSE ๐Ÿ”’

Staticsยง

POOL ๐Ÿ”’ Non-pyo3_disable_reference_pool

Functionsยง

decrement_attach_count ๐Ÿ”’
Decrements pyo3โ€™s internal attach count - to be called whenever AttachGuard is dropped.
drop_deferred_references ๐Ÿ”’
increment_attach_count ๐Ÿ”’
Increments pyo3โ€™s internal attach count - to be called whenever an AttachGuard is created.
is_in_gc_traversal ๐Ÿ”’ Py_3_11 or non-Py_LIMITED_API
Private helper function to check if we are currently in a GC traversal (as detected by PyO3).
register_decref
Registers a Python object pointer inside the release pool, to have its reference count decreased the next time the thread is attached in pyo3.
thread_is_attached ๐Ÿ”’
Checks whether the thread is attached to the Python interpreter.

Type Aliasesยง

PyObjVec ๐Ÿ”’ Non-pyo3_disable_reference_pool
โš ๏ธ Internal Docs โš ๏ธ Not Public API ๐Ÿ‘‰ Official Docs Here