Skip to content

Commit 1890665

Browse files
committed
fixit
1 parent 6ce88e0 commit 1890665

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Lib/test/test_module/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class BareLoader:
1818

1919

2020
class ModuleTests(unittest.TestCase):
21+
@unittest.expectedFailure # TODO: RUSTPYTHON
2122
def test_uninitialized(self):
2223
# An uninitialized module has no __dict__ or __name__,
2324
# and __doc__ is None

Lib/test/test_property.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ def documented_getter():
342342
with self.assertRaises(AttributeError):
343343
p = slotted_prop(documented_getter)
344344

345-
@unittest.expectedFailure # TODO: RUSTPYTHON
346345
@unittest.skipIf(sys.flags.optimize >= 2,
347346
"Docstrings are omitted with -O2 and above")
348347
def test_property_with_slots_and_doc_slot_docstring_present(self):

crates/vm/src/builtins/type.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,16 @@ impl Constructor for PyType {
12351235
}
12361236
}
12371237

1238+
// Set __doc__ to None if not already present in the type's dict
1239+
// This matches CPython's behavior in type_dict_set_doc (typeobject.c)
1240+
// which ensures every type has a __doc__ entry in its dict
1241+
{
1242+
let __doc__ = identifier!(vm, __doc__);
1243+
if !typ.attributes.read().contains_key(&__doc__) {
1244+
typ.attributes.write().insert(__doc__, vm.ctx.none());
1245+
}
1246+
}
1247+
12381248
// avoid deadlock
12391249
let attributes = typ
12401250
.attributes

0 commit comments

Comments
 (0)