File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -197,8 +197,6 @@ def f(o):
197197 with self .assertRaises (TypeError ):
198198 f (o )
199199
200- # TODO: RUSTPYTHON
201- @unittest .expectedFailure
202200 def test_store_shadowing_slot_should_raise_type_error (self ):
203201 class Class :
204202 __slots__ = ("slot" ,)
Original file line number Diff line number Diff line change @@ -274,6 +274,16 @@ impl PyMemberDescriptor {
274274 vm : & VirtualMachine ,
275275 ) -> PyResult < ( ) > {
276276 let zelf = Self :: _as_pyref ( zelf, vm) ?;
277+
278+ if !obj. class ( ) . fast_issubclass ( & zelf. common . typ ) {
279+ return Err ( vm. new_type_error ( format ! (
280+ "descriptor '{}' for '{}' objects doesn't apply to a '{}' object" ,
281+ zelf. common. name,
282+ zelf. common. typ. name( ) ,
283+ obj. class( ) . name( )
284+ ) ) ) ;
285+ }
286+
277287 zelf. member . set ( obj, value, vm)
278288 }
279289}
You can’t perform that action at this time.
0 commit comments