We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parenta7c3f85 commitd24f79bCopy full SHA for d24f79b
vm/src/obj/objtype.rs
@@ -2,8 +2,8 @@ use super::objdict;
2
usesuper::objstr;
3
usesuper::objtype;// Required for arg_check! to use isinstance
4
usecrate::pyobject::{
5
-AttributeProtocol,IdProtocol,PyAttributes,PyContext,PyFuncArgs,PyObject,PyObjectPayload,
6
-PyObjectRef,PyResult,TypeProtocol,
+AttributeProtocol,DictProtocol,IdProtocol,PyAttributes,PyContext,PyFuncArgs,PyObject,
+PyObjectPayload,PyObjectRef,PyResult,TypeProtocol,
7
};
8
usecrate::vm::VirtualMachine;
9
use std::cell::RefCell;
@@ -277,6 +277,13 @@ pub fn get_attributes(obj: &PyObjectRef) -> PyAttributes {
277
attributes.insert(name.to_string(), value.clone());
278
}
279
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
287
attributes
288
289