comparison rust/hg-pyo3/src/utils.rs @ 52976:d934d730c6c2

pyO3: remove useless (and wrong) `__doc__` attribute on modules PyO3 overrides the `__doc__` attributes to use the module's docstring.
author Rapha?l Gom?s <rgomes@octobus.net>
date Tue, 18 Feb 2025 11:33:20 +0100
parents 6b3b69b32a41
children 0c7ac026ed63
comparison
equal deleted inserted replaced
52975:0db5f7987b13 52976:d934d730c6c2
21 name: &str, 21 name: &str,
22 ) -> PyResult<Bound<'py, PyModule>> { 22 ) -> PyResult<Bound<'py, PyModule>> {
23 let dotted_name = &format!("{}.{}", package_name, name); 23 let dotted_name = &format!("{}.{}", package_name, name);
24 let m = PyModule::new(py, name)?; 24 let m = PyModule::new(py, name)?;
25 m.add("__package__", package_name)?; 25 m.add("__package__", package_name)?;
26 m.add("__doc__", "DAG operations - Rust implementation")?;
27 26
28 let sys = PyModule::import(py, "sys")?; 27 let sys = PyModule::import(py, "sys")?;
29 // according to the doc, we could make a static PyString out of 28 // according to the doc, we could make a static PyString out of
30 // "modules" with the `intern!` macro, but this is used only at 29 // "modules" with the `intern!` macro, but this is used only at
31 // registration so it may not be worth the effort. 30 // registration so it may not be worth the effort.