mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Output locals mapping in trace logging
The Locals line in the Frame Object output is now, for example:
Locals: {"num": RefCell { value: [PyObj int 9] }, "f": RefCell { value: [PyObj function] }}
This commit is contained in:
@@ -114,11 +114,16 @@ impl fmt::Debug for Frame {
|
||||
.map(|elem| format!("\n > {:?}", elem))
|
||||
.collect::<Vec<_>>()
|
||||
.join("");
|
||||
let local_str = "".to_string(); /* self.locals
|
||||
.iter()
|
||||
.map(|elem| format!("\n {} = {}", elem.0, elem.1.borrow_mut().str()))
|
||||
.collect::<Vec<_>>()
|
||||
.join(""); */
|
||||
let local_str = match self.locals.borrow().kind {
|
||||
PyObjectKind::Scope { ref scope } => match scope.locals.borrow().kind {
|
||||
PyObjectKind::Dict { ref elements } => format!(" {:?}", elements),
|
||||
ref unexpected => format!(
|
||||
"locals unexpectedly not wrapping a dict! instead: {:?}",
|
||||
unexpected
|
||||
),
|
||||
},
|
||||
ref unexpected => format!("locals unexpectedly not a scope! instead: {:?}", unexpected),
|
||||
};
|
||||
write!(
|
||||
f,
|
||||
"Frame Object {{ \n Stack:{}\n Blocks:{}\n Locals:{}\n}}",
|
||||
|
||||
Reference in New Issue
Block a user