@@ -29,7 +29,7 @@ fn valid_dispatch_types(py: Python, cls: &Bound<'_, PyAny>) -> PyResult<Vec<Py<P
2929 } else {
3030 let typing_module = TypingModule :: cached ( py) ;
3131 if let Ok ( origin) = typing_module. get_origin ( py, cls) {
32- if typing_module. is_union_type ( py, origin. bind ( py) ) {
32+ if typing_module. is_union_type ( py, origin. bind ( py) ) ? {
3333 if let Ok ( type_args) = typing_module. get_args ( py, cls) {
3434 let py_tuple = type_args. bind ( py) ;
3535 let mut dispatch_types = Vec :: with_capacity ( py_tuple. len ( ) ) ;
@@ -74,7 +74,7 @@ struct SingleDispatchState {
7474
7575impl SingleDispatchState {
7676 fn find_impl ( & mut self , py : Python , cls : Bound < ' _ , PyAny > ) -> PyResult < PyObject > {
77- let cls_mro = get_obj_mro ( & cls. clone ( ) ) . unwrap ( ) ;
77+ let cls_mro = get_obj_mro ( & cls. clone ( ) ) ? ;
7878 let mro = match compose_mro ( py, cls. clone ( ) , self . registry . keys ( ) ) {
7979 Ok ( mro) => mro,
8080 Err ( e) => return Err ( e) ,
@@ -166,7 +166,7 @@ impl SingleDispatch {
166166 match self . lock . lock ( ) {
167167 Ok ( mut state) => {
168168 let unbound_func = func. unbind ( ) ;
169- if typing_module. is_union_type ( py, & cls) {
169+ if typing_module. is_union_type ( py, & cls) ? {
170170 match typing_module. get_args ( py, & cls) {
171171 Ok ( tuple) => {
172172 for tp in tuple. bind ( py) . iter ( ) {
0 commit comments