File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ class BareLoader:
1818
1919
2020class 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
Original file line number Diff line number Diff 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 ):
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments