Skip to content

Commit 17c3f9f

Browse files
committed
builtin_locals can just return a reference to the locals dict.
1 parent 3562b8f commit 17c3f9f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

vm/src/builtins.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use num_traits::{Signed, ToPrimitive};
1111
use crate::compile;
1212
use crate::import::import_module;
1313
use crate::obj::objbool;
14-
use crate::obj::objdict;
1514
use crate::obj::objint;
1615
use crate::obj::objiter;
1716
use crate::obj::objstr::{self, PyStringRef};
@@ -29,14 +28,7 @@ use crate::obj::objcode::PyCodeRef;
2928
use crate::stdlib::io::io_open;
3029

3130
fn get_locals(vm: &VirtualMachine) -> PyObjectRef {
32-
let d = vm.new_dict();
33-
// TODO: implement dict_iter_items?
34-
let locals = vm.get_locals();
35-
let key_value_pairs = objdict::get_key_value_pairs(&locals);
36-
for (key, value) in key_value_pairs {
37-
objdict::set_item(&d, vm, &key, &value);
38-
}
39-
d
31+
vm.get_locals()
4032
}
4133

4234
fn dir_locals(vm: &VirtualMachine) -> PyObjectRef {

0 commit comments

Comments
 (0)