Comment/docstring cleanup only, no functional changes

- Fix stale claim in RustRuntime's doc: with skip_from_py_object, pyo3
  does not clone-extract the pyclass; callers clone explicitly.
- Fix changelog grammar and 'per-reactor' -> 'per-homeserver'.
- Fix garden-path sentence in runtime.pyi docstring.
- Minor punctuation fixes in new doc comments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik Johnston
2026-08-05 15:48:22 +00:00
co-authored by Claude Fable 5
parent 6a54271866
commit 775ce6cab7
5 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -1 +1 @@
Refactor Rust code have a single place to store per-reactor state.
Refactor the Rust code to have a single place to store per-homeserver state.
+1 -1
View File
@@ -23,7 +23,7 @@ use crate::runtime::RustRuntime;
/// The Python `HomeServer`, as seen from Rust.
///
/// Like [`crate::reactor::Reactor`], this is a typed facade over a foreign
/// Python object: it does no validation of the object it wraps (the Python
/// Python object. It does no validation of the object it wraps (the Python
/// side is type-checked by mypy), but it is the single place that names the
/// `HomeServer` API surface that Rust code depends on.
pub struct HomeServer(Py<PyAny>);
+1 -1
View File
@@ -19,7 +19,7 @@ use pyo3::{call::PyCallArgs, intern, prelude::*};
/// The Twisted reactor, as seen from Rust.
///
/// A typed facade over a foreign Python object: it does no validation of the
/// A typed facade over a foreign Python object. It does no validation of the
/// object it wraps (the Python side is type-checked by mypy), but it is the
/// single place that names the Twisted API surface that Rust code depends
/// on.
+3 -4
View File
@@ -125,9 +125,8 @@ impl Drop for RustRuntimeInner {
///
/// One instance is constructed per homeserver by
/// `HomeServer.get_rust_runtime()`. Rust classes that need it take it as a
/// constructor argument — pyo3 extracts a `#[pyclass]` that is `Clone` by
/// cloning, which here is just an `Arc` refcount bump — and hold their own
/// clone. Derefs to [`RustRuntimeInner`].
/// constructor argument and store their own clone, which is just an `Arc`
/// refcount bump. Derefs to [`RustRuntimeInner`].
#[pyclass(frozen, skip_from_py_object)]
#[derive(Clone)]
pub struct RustRuntime {
@@ -154,7 +153,7 @@ impl RustRuntime {
});
// Shut the tokio runtime down when the reactor does. The trigger
// holds only a `Weak` reference: Twisted keeping the hook alive must
// holds only a `Weak` reference. Twisted keeping the hook alive must
// not keep the runtime (nor, via it, the reactor) alive, as that
// would be a reference cycle passing through a Rust field that
// Python's GC cannot see into.
+1 -1
View File
@@ -5,7 +5,7 @@ class RustRuntime:
Holds the tokio thread pool (started lazily on first use, shut down by a
reactor shutdown trigger) and a handle to the reactor. Rust classes that
need either take this as a constructor argument; get it from
need them take this as a constructor argument. Get it from
`hs.get_rust_runtime()`.
"""