Merge pull request #4507 from howjmay/co_cellvars

Add co_cellvars to code object
This commit is contained in:
Jim Fasarakis-Hilliard authored and GitHub committed 2023-02-16 09:25:44 +02:00
commit 5ec62358b3
1 file changed
+12
+12
View File
@@ -218,6 +218,18 @@ impl PyRef<PyCode> {
self.code.source_path.to_owned()
}
#[pygetset]
pub fn co_cellvars(self, vm: &VirtualMachine) -> PyTupleRef {
let cellvars = self
.code
.cellvars
.deref()
.iter()
.map(|name| name.to_pyobject(vm))
.collect();
vm.ctx.new_tuple(cellvars)
}
#[pygetset]
fn co_firstlineno(self) -> usize {
self.code.first_line_number