comparison rust/hg-cpython/src/lib.rs @ 41130:d43719bd01f0

rust-cpython: remove invalid __package__ attribute Since mercurial.rustext is a package, its __package__ should be, if set, "mercurial.rustext". AFAIK, we don't have to set this attribute manually as the rustext module will be imported by the system importer. https://stackoverflow.com/a/21233334/10435339
author Yuya Nishihara <yuya@tcha.org>
date Sun, 06 Jan 2019 11:29:44 +0900
parents 4c25038c112c
children dcf818267bc1
comparison
equal deleted inserted replaced
41129:074c72a38423 41130:d43719bd01f0
33 "__doc__", 33 "__doc__",
34 "Mercurial core concepts - Rust implementation", 34 "Mercurial core concepts - Rust implementation",
35 )?; 35 )?;
36 36
37 let dotted_name: String = m.get(py, "__name__")?.extract(py)?; 37 let dotted_name: String = m.get(py, "__name__")?.extract(py)?;
38 m.add(py, "__package__", "mercurial")?;
39 m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?; 38 m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?;
40 m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?; 39 m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?;
41 Ok(()) 40 Ok(())
42 }); 41 });