mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Merge pull request #4507 from howjmay/co_cellvars
Add co_cellvars to code object
This commit is contained in:
1 file changed
+12
@@ -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
|
||||
|
||||
Reference in new issue
Block a user