Skip to content

Commit 3bce41b

Browse files
authored
Fix test_typing.test_unpack_wrong_type (#6009)
1 parent 99c1afe commit 3bce41b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Lib/test/test_descr.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5074,8 +5074,6 @@ class Child(Parent):
50745074
gc.collect()
50755075
self.assertEqual(Parent.__subclasses__(), [])
50765076

5077-
# TODO: RUSTPYTHON
5078-
@unittest.expectedFailure
50795077
def test_attr_raise_through_property(self):
50805078
# test case for gh-103272
50815079
class A:

Lib/test/test_typing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,8 +1228,6 @@ class New[*Ts]: ...
12281228
self.assertEqual(PartNew[Unpack[tuple[str]]].__args__, (int, str))
12291229
self.assertEqual(PartNew[Unpack[Tuple[str]]].__args__, (int, str))
12301230

1231-
# TODO: RUSTPYTHON
1232-
@unittest.expectedFailure
12331231
def test_unpack_wrong_type(self):
12341232
Ts = TypeVarTuple("Ts")
12351233
class Gen[*Ts]: ...

vm/src/types/slot.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ fn getattro_wrapper(zelf: &PyObject, name: &Py<PyStr>, vm: &VirtualMachine) -> P
286286
let __getattr__ = identifier!(vm, __getattr__);
287287
match vm.call_special_method(zelf, __getattribute__, (name.to_owned(),)) {
288288
Ok(r) => Ok(r),
289-
Err(_) if zelf.class().has_attr(__getattr__) => {
289+
Err(e)
290+
if e.fast_isinstance(vm.ctx.exceptions.attribute_error)
291+
&& zelf.class().has_attr(__getattr__) =>
292+
{
290293
vm.call_special_method(zelf, __getattr__, (name.to_owned(),))
291294
}
292295
Err(e) => Err(e),

0 commit comments

Comments
 (0)