File tree 2 files changed +21
-10
lines changed 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change
1
+
2
+ a = 5
3
+ b = 6
4
+
5
+ loc = locals ()
6
+
7
+ assert loc ['a' ] == 5
8
+ assert loc ['b' ] == 6
9
+
10
+ def f ():
11
+ c = 4
12
+ a = 7
13
+
14
+ loc = locals ()
15
+
16
+ assert loc ['a' ] == 4
17
+ assert loc ['c' ] == 7
18
+ assert not 'b' in loc
19
+
Original file line number Diff line number Diff line change @@ -208,16 +208,8 @@ impl VirtualMachine {
208
208
}
209
209
210
210
pub fn get_locals ( & self ) -> PyObjectRef {
211
- // let scope = &self.frames.last().unwrap().locals;
212
- // scope.clone()
213
- // TODO: fix this!
214
- self . get_none ( )
215
- /*
216
- match (*scope).payload {
217
- PyObjectPayload::Scope { scope } => { scope.locals.clone() },
218
- _ => { panic!("Should be scope") },
219
- } // .clone()
220
- */
211
+ let scope = self . current_scope ( ) ;
212
+ scope. locals . clone ( )
221
213
}
222
214
223
215
pub fn context ( & self ) -> & PyContext {
You can’t perform that action at this time.
0 commit comments