File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -67,15 +67,28 @@ impl<R: Runtime, T: Manager<R> + Sync> crate::PythonExt<R> for T {
6767 if INIT_BLOCKED . load ( std:: sync:: atomic:: Ordering :: Relaxed ) {
6868 return Err ( "Cannot register after function called" . into ( ) ) ;
6969 }
70-
7170 FUNCTION_MAP
7271 . lock ( )
7372 . unwrap ( )
7473 . insert ( payload. python_function_call . clone ( ) ) ;
74+
7575 let _tmp = self
7676 . runner ( )
7777 . read_variable ( & payload. python_function_call )
7878 . await ?;
79+ if let Some ( num_args) = payload. number_of_args {
80+ let py_analyze_sig = format ! (
81+ r#"
82+ from inspect import signature
83+ if len(signature({}).parameters) != {}:
84+ raise Exception("Function parameters don't match in 'registerFunction'")
85+ "# ,
86+ & payload. python_function_call, num_args
87+ ) ;
88+ self . runner ( ) . run ( & py_analyze_sig) . await . unwrap_or_else ( |_| {
89+ panic ! ( "Number of args doesn't match signature of {}." , payload. python_function_call)
90+ } ) ;
91+ } ;
7992 Ok ( StringResponse { value : "Ok" . into ( ) } )
8093 }
8194
You can’t perform that action at this time.
0 commit comments