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

Commitd24f79b

Browse files
committed
dir show module content
1 parenta7c3f85 commitd24f79b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎vm/src/obj/objtype.rs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use super::objdict;
22
usesuper::objstr;
33
usesuper::objtype;// Required for arg_check! to use isinstance
44
usecrate::pyobject::{
5-
AttributeProtocol,IdProtocol,PyAttributes,PyContext,PyFuncArgs,PyObject,PyObjectPayload,
6-
PyObjectRef,PyResult,TypeProtocol,
5+
AttributeProtocol,DictProtocol,IdProtocol,PyAttributes,PyContext,PyFuncArgs,PyObject,
6+
PyObjectPayload,PyObjectRef,PyResult,TypeProtocol,
77
};
88
usecrate::vm::VirtualMachine;
99
use std::cell::RefCell;
@@ -277,6 +277,13 @@ pub fn get_attributes(obj: &PyObjectRef) -> PyAttributes {
277277
attributes.insert(name.to_string(), value.clone());
278278
}
279279
}
280+
281+
// Get module attributes:
282+
ifletPyObjectPayload::Module{ref scope, ..} =&obj.payload{
283+
for(name, value)in scope.locals.get_key_value_pairs().iter(){
284+
attributes.insert(objstr::get_value(name).to_string(), value.clone());
285+
}
286+
}
280287
attributes
281288
}
282289

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp