@@ -29,7 +29,7 @@ fn valid_dispatch_types(py: Python, cls: &Bound<'_, PyAny>) -> PyResult<Vec<Py<P
29
29
} else {
30
30
let typing_module = TypingModule :: cached ( py) ;
31
31
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) ) ? {
33
33
if let Ok ( type_args) = typing_module. get_args ( py, cls) {
34
34
let py_tuple = type_args. bind ( py) ;
35
35
let mut dispatch_types = Vec :: with_capacity ( py_tuple. len ( ) ) ;
@@ -74,7 +74,7 @@ struct SingleDispatchState {
74
74
75
75
impl SingleDispatchState {
76
76
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 ( ) ) ? ;
78
78
let mro = match compose_mro ( py, cls. clone ( ) , self . registry . keys ( ) ) {
79
79
Ok ( mro) => mro,
80
80
Err ( e) => return Err ( e) ,
@@ -166,7 +166,7 @@ impl SingleDispatch {
166
166
match self . lock . lock ( ) {
167
167
Ok ( mut state) => {
168
168
let unbound_func = func. unbind ( ) ;
169
- if typing_module. is_union_type ( py, & cls) {
169
+ if typing_module. is_union_type ( py, & cls) ? {
170
170
match typing_module. get_args ( py, & cls) {
171
171
Ok ( tuple) => {
172
172
for tp in tuple. bind ( py) . iter ( ) {
0 commit comments