##// END OF EJS Templates
rust-pyo3: exposition of AncestorsIterator...
rust-pyo3: exposition of AncestorsIterator Compared to the early experiments, we have one less `RwLock` in the wrapping. Still that is somewhat redundant with `UnsafePyLeaked` being itself some kind of lock. In the original rust-cpython code, we were borrowing the `RefCell` with a method that can panic. Instead we are now converting the `PoisonError` that unlocking a `RwLock` can produce. Since all methods acquiring the `RwLock` are themselves protected by the GIL and do not release it before returning, nor do they leak RwLock guards, there is no risk of contention on these locks themselves.

File last commit:

r53428:4c9e3198 default
r53428:4c9e3198 default
Show More
lib.rs
25 lines | 738 B | application/rls-services+xml | RustLexer
use pyo3::prelude::*;
mod ancestors;
mod convert_cpython;
mod dagops;
mod exceptions;
mod revision;
mod util;
#[pymodule]
fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add(
"__doc__",
"Mercurial core concepts - Rust implementation exposed via PyO3",
)?;
// the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext
// (at least at this point).
let name: String = m.getattr("__name__")?.extract()?;
let dotted_name = format!("mercurial.{}", name);
m.add_submodule(&ancestors::init_module(py, &dotted_name)?)?;
m.add_submodule(&dagops::init_module(py, &dotted_name)?)?;
m.add("GraphError", py.get_type::<exceptions::GraphError>())?;
Ok(())
}