Skip to main content

Module state

Module state 

Source
Expand description

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

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 ๐Ÿ”’
get_pool ๐Ÿ”’ Non-pyo3_disable_reference_pool
increment_attach_count ๐Ÿ”’
Increments pyo3โ€™s internal attach count - to be called whenever an AttachGuard is created.
is_in_gc_traversal ๐Ÿ”’ Non-Py_LIMITED_API or Py_3_11
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