Skip to content

Commit da332c8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into update-netrc
2 parents 0114646 + e922722 commit da332c8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Lib/test/test_opcache.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff 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",)

vm/src/builtins/descriptor.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)