Mercurial > public > mercurial-scm > hg
view rust/hg-cpython/src/utils.rs @ 44070:451d22174b5f
revlog: run rustfmt nightly
I'm a little nervous about folding this back (might be nightly rustfmt
mismatches?) so I want someone to review this.
Differential Revision: https://phab.mercurial-scm.org/D7813
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 08 Jan 2020 14:37:54 -0500 |
parents | 970978975574 |
children | d738b7a18438 |
line wrap: on
line source
use cpython::{PyDict, PyObject, PyResult, PyTuple, Python}; #[allow(unused)] pub fn print_python_trace(py: Python) -> PyResult<PyObject> { eprintln!("==============================="); eprintln!("Printing Python stack from Rust"); eprintln!("==============================="); let traceback = py.import("traceback")?; let sys = py.import("sys")?; let kwargs = PyDict::new(py); kwargs.set_item(py, "file", sys.get(py, "stderr")?)?; traceback.call(py, "print_stack", PyTuple::new(py, &[]), Some(&kwargs)) }