@@ -37,7 +37,7 @@ use crate::obj::objiter;
3737use crate :: obj:: objlist:: PyList ;
3838use crate :: obj:: objmodule:: { self , PyModule } ;
3939use crate :: obj:: objstr:: { PyString , PyStringRef } ;
40- use crate :: obj:: objtuple:: { PyTuple , PyTupleRef } ;
40+ use crate :: obj:: objtuple:: PyTuple ;
4141use crate :: obj:: objtype:: { self , PyClassRef } ;
4242use crate :: pyhash;
4343use crate :: pyobject:: {
@@ -726,7 +726,7 @@ impl VirtualMachine {
726726 }
727727
728728 pub fn invoke_python_function ( & self , func : & PyFunction , func_args : PyFuncArgs ) -> PyResult {
729- self . invoke_python_function_with_scope ( func, func_args, & func. scope )
729+ self . invoke_python_function_with_scope ( func, func_args, func. scope ( ) )
730730 }
731731
732732 pub fn invoke_python_function_with_scope (
@@ -743,13 +743,7 @@ impl VirtualMachine {
743743 scope. clone ( )
744744 } ;
745745
746- self . fill_locals_from_args (
747- & code,
748- & scope. get_locals ( ) ,
749- func_args,
750- & func. defaults ,
751- & func. kw_only_defaults ,
752- ) ?;
746+ self . fill_locals_from_args ( & code, & scope. get_locals ( ) , func_args, func) ?;
753747
754748 // Construct frame:
755749 let frame = Frame :: new ( code. clone ( ) , scope) . into_ref ( self ) ;
@@ -769,8 +763,7 @@ impl VirtualMachine {
769763 code_object : & bytecode:: CodeObject ,
770764 locals : & PyDictRef ,
771765 func_args : PyFuncArgs ,
772- defaults : & Option < PyTupleRef > ,
773- kw_only_defaults : & Option < PyDictRef > ,
766+ func : & PyFunction ,
774767 ) -> PyResult < ( ) > {
775768 let nargs = func_args. args . len ( ) ;
776769 let nexpected_args = code_object. arg_names . len ( ) ;
@@ -849,6 +842,9 @@ impl VirtualMachine {
849842 }
850843 }
851844
845+ let defaults = & func. defaults ;
846+ let kw_only_defaults = & func. kw_only_defaults ;
847+
852848 // Add missing positional arguments, if we have fewer positional arguments than the
853849 // function definition calls for
854850 if nargs < nexpected_args {
0 commit comments