Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixit
  • Loading branch information
youknowone committed Dec 10, 2025
commit 32a51b142cae4bb183c0e00f0fdcad36fb7f3e74
1 change: 0 additions & 1 deletion Lib/test/test_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ def documented_getter():
with self.assertRaises(AttributeError):
p = slotted_prop(documented_getter)

@unittest.expectedFailure # TODO: RUSTPYTHON
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_with_slots_and_doc_slot_docstring_present(self):
Expand Down
10 changes: 10 additions & 0 deletions crates/vm/src/builtins/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,16 @@ impl Constructor for PyType {
}
}

// Set __doc__ to None if not already present in the type's dict
// This matches CPython's behavior in type_dict_set_doc (typeobject.c)
// which ensures every type has a __doc__ entry in its dict
{
let __doc__ = identifier!(vm, __doc__);
if !typ.attributes.read().contains_key(&__doc__) {
typ.attributes.write().insert(__doc__, vm.ctx.none());
}
}

// avoid deadlock
let attributes = typ
.attributes
Expand Down
Loading