##// END OF EJS Templates
transaction: fix __repr__() and make the default name bytes...
transaction: fix __repr__() and make the default name bytes This likely was always wrong on py3, since going back to aff5996f3043, these were added as a r-strings. Callers seem to always be supplying bytes, which makes the `b'/'.join(...)` part OK, but then bytes can't be interpolated into str with "%s", so it wouldn't have worked in either case.

File last commit:

r45406:9f96beb9 default
r51761:0a4efb65 stable
Show More
debug.rs
24 lines | 822 B | application/rls-services+xml | RustLexer
// debug.rs
//
// Copyright 2020 Raphaël Gomès <rgomes@octobus.net>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//! Module to get debug information about Rust extensions.
use cpython::{PyDict, PyModule, PyResult, Python};
/// Create the module, with `__package__` given from parent
pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> {
let dotted_name = &format!("{}.debug", package);
let m = PyModule::new(py, dotted_name)?;
m.add(py, "__package__", package)?;
m.add(py, "__doc__", "Rust debugging information")?;
let sys = PyModule::import(py, "sys")?;
let sys_modules: PyDict = sys.get(py, "modules")?.extract(py)?;
sys_modules.set_item(py, dotted_name, &m)?;
Ok(m)
}