forked from Rust-related/RustPython
objtype: Set __doc__ as None if not included
This set __doc__ as None if it is not included in attribute while making new instance of type. In cpython if there is no docstring in class definition, __doc__ attribute will be None. So RustPython should follow it. Partially solves #1523
This commit is contained in:
@@ -321,7 +321,12 @@ fn type_new_slot(metatype: PyClassRef, args: PyFuncArgs, vm: &VirtualMachine) ->
|
||||
bases
|
||||
};
|
||||
|
||||
let attributes = dict.to_attributes();
|
||||
let mut attributes = dict.to_attributes();
|
||||
|
||||
// insert __doc__ as None if it is not included in attributes
|
||||
if !attributes.contains_key("__doc__") {
|
||||
attributes.insert("__doc__".to_string(), vm.ctx.none());
|
||||
}
|
||||
|
||||
let mut winner = metatype.clone();
|
||||
for base in &bases {
|
||||
|
||||
Reference in New Issue
Block a user