Move varargs information into CodeFlags

This commit is contained in:
Noah
2020-04-02 09:02:18 -05:00
parent c1c9631798
commit 6553bf72d4
6 changed files with 94 additions and 54 deletions

View File

@@ -106,6 +106,16 @@ impl PyCodeRef {
fn co_flags(self) -> u8 {
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) {