Merge pull request #1834 from RustPython/coolreader18/jsontests

Add json output for CPython tests
This commit is contained in:
Noah
2020-04-04 11:52:04 -05:00
committed by GitHub
14 changed files with 782 additions and 73 deletions

View File

@@ -106,6 +106,16 @@ impl PyCodeRef {
fn co_flags(self) -> u16 {
self.code.flags.bits()
}
#[pyproperty]
fn co_varnames(self, vm: &VirtualMachine) -> PyObjectRef {
let varnames = self
.code
.varnames()
.map(|s| vm.new_str(s.to_owned()))
.collect();
vm.ctx.new_tuple(varnames)
}
}
pub fn init(ctx: &PyContext) {