diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 0bbcc31fb8..adff90456e 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -8546,8 +8546,6 @@ def test_valid_uses(self): self.assertEqual(C4.__args__, (P, T)) self.assertEqual(C4.__parameters__, (P, T)) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_args_kwargs(self): P = ParamSpec('P') P_2 = ParamSpec('P_2') diff --git a/vm/src/stdlib/typevar.rs b/vm/src/stdlib/typevar.rs index a8962acc90..11c20ba787 100644 --- a/vm/src/stdlib/typevar.rs +++ b/vm/src/stdlib/typevar.rs @@ -833,11 +833,12 @@ impl Comparable for ParamSpecArgs { fn eq( zelf: &crate::Py, other: PyObjectRef, - vm: &VirtualMachine, + _vm: &VirtualMachine, ) -> PyResult { - // Check if other has __origin__ attribute - if let Ok(other_origin) = other.get_attr("__origin__", vm) { - return Ok(zelf.__origin__.is(&other_origin)); + // First check if other is also ParamSpecArgs + if let Ok(other_args) = other.downcast::() { + // Check if they have the same origin + return Ok(zelf.__origin__.is(&other_args.__origin__)); } Ok(false) } @@ -911,11 +912,12 @@ impl Comparable for ParamSpecKwargs { fn eq( zelf: &crate::Py, other: PyObjectRef, - vm: &VirtualMachine, + _vm: &VirtualMachine, ) -> PyResult { - // Check if other has __origin__ attribute - if let Ok(other_origin) = other.get_attr("__origin__", vm) { - return Ok(zelf.__origin__.is(&other_origin)); + // First check if other is also ParamSpecKwargs + if let Ok(other_kwargs) = other.downcast::() { + // Check if they have the same origin + return Ok(zelf.__origin__.is(&other_kwargs.__origin__)); } Ok(false) }