@@ -353,11 +353,11 @@ impl VirtualMachine {
353353
354354 pub fn invoke_exception (
355355 & self ,
356- cls : PyTypeRef ,
356+ cls : & Py < PyType > ,
357357 args : Vec < PyObjectRef > ,
358358 ) -> PyResult < PyBaseExceptionRef > {
359359 // TODO: fast-path built-in exceptions by directly instantiating them? Is that really worth it?
360- let res = PyType :: call ( & cls, args. into_args ( self ) , self ) ?;
360+ let res = PyType :: call ( cls, args. into_args ( self ) , self ) ?;
361361 res. downcast :: < PyBaseException > ( ) . map_err ( |obj| {
362362 self . new_type_error ( format ! (
363363 "calling {} should have returned an instance of BaseException, not {}" ,
@@ -444,7 +444,7 @@ impl TryFromObject for ExceptionCtor {
444444impl ExceptionCtor {
445445 pub fn instantiate ( self , vm : & VirtualMachine ) -> PyResult < PyBaseExceptionRef > {
446446 match self {
447- Self :: Class ( cls) => vm. invoke_exception ( cls, vec ! [ ] ) ,
447+ Self :: Class ( cls) => vm. invoke_exception ( & cls, vec ! [ ] ) ,
448448 Self :: Instance ( exc) => Ok ( exc) ,
449449 }
450450 }
@@ -472,7 +472,7 @@ impl ExceptionCtor {
472472 exc @ PyBaseException => exc. args( ) . to_vec( ) ,
473473 obj => vec![ obj] ,
474474 } ) ;
475- vm. invoke_exception ( cls, args)
475+ vm. invoke_exception ( & cls, args)
476476 }
477477 }
478478 }
@@ -2101,7 +2101,7 @@ pub(super) mod types {
21012101 . downcast_ref :: < PyInt > ( )
21022102 . and_then ( |errno| errno. try_to_primitive :: < i32 > ( vm) . ok ( ) )
21032103 . and_then ( |errno| super :: errno_to_exc_type ( errno, vm) )
2104- . and_then ( |typ| vm. invoke_exception ( typ. to_owned ( ) , args_vec) . ok ( ) )
2104+ . and_then ( |typ| vm. invoke_exception ( typ, args_vec) . ok ( ) )
21052105 {
21062106 return error. to_pyresult ( vm) ;
21072107 }
0 commit comments