Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81a85cc

Browse files
Merge pull requestRustPython#599 from palaviv/Fix-locals
Fix locals
2 parents458ead0 +a545e43 commit81a85cc

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

‎tests/snippets/builtin_locals.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
a=5
3+
b=6
4+
5+
loc=locals()
6+
7+
assertloc['a']==5
8+
assertloc['b']==6
9+
10+
deff():
11+
c=4
12+
a=7
13+
14+
loc=locals()
15+
16+
assertloc['a']==4
17+
assertloc['c']==7
18+
assertnot'b'inloc
19+

‎vm/src/vm.rs‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,8 @@ impl VirtualMachine {
208208
}
209209

210210
pubfnget_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()
221213
}
222214

223215
pubfncontext(&self) ->&PyContext{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp