mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix dis.dis to prints inner constant codes like CPython
This commit is contained in:
1 parent
04e7b5ada4
commit
9e78ec9ef9
4 files changed
+14
-3
No files matched your search
@@ -488,7 +488,17 @@ impl CodeObject {
|
||||
|
||||
impl fmt::Display for CodeObject {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.display_inner(f, false, 1)
|
||||
self.display_inner(f, false, 1)?;
|
||||
for constant in self.get_constants() {
|
||||
match constant {
|
||||
Constant::Code { code } => {
|
||||
write!(f, "\nDisassembly of {}\n", constant)?;
|
||||
code.fmt(f)?;
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user