@@ -1212,10 +1212,7 @@ def _handle_series_map(self, assign, lhs, rhs, series_var):
12121212 # error checking: make sure there is function input only
12131213 if len (rhs .args ) != 1 :
12141214 raise ValueError ("map expects 1 argument" )
1215- func = guard (get_definition , self .state .func_ir , rhs .args [0 ])
1216- if func is None or not (isinstance (func , ir .Expr )
1217- and func .op == 'make_function' ):
1218- raise ValueError ("lambda for map not found" )
1215+ func = guard (get_definition , self .state .func_ir , rhs .args [0 ]).value .py_func
12191216
12201217 dtype = self .state .typemap [series_var .name ].dtype
12211218 nodes = []
@@ -1382,11 +1379,7 @@ def _handle_series_combine(self, assign, lhs, rhs, series_var):
13821379 raise ValueError ("not enough arguments in call to combine" )
13831380 if len (rhs .args ) > 3 :
13841381 raise ValueError ("too many arguments in call to combine" )
1385- func = guard (get_definition , self .state .func_ir , rhs .args [1 ])
1386- if func is None or not (isinstance (func , ir .Expr )
1387- and func .op == 'make_function' ):
1388- raise ValueError ("lambda for combine not found" )
1389-
1382+ func = guard (get_definition , self .state .func_ir , rhs .args [1 ]).value .py_func
13901383 out_typ = self .state .typemap [lhs .name ].dtype
13911384 other = rhs .args [0 ]
13921385 nodes = []
@@ -1533,19 +1526,16 @@ def f(arr, w, center): # pragma: no cover
15331526 def _handle_rolling_apply_func (self , func_node , dtype , out_dtype ):
15341527 if func_node is None :
15351528 raise ValueError ("cannot find kernel function for rolling.apply() call" )
1529+ func_node = func_node .value .py_func
15361530 # TODO: more error checking on the kernel to make sure it doesn't
15371531 # use global/closure variables
1538- if func_node .closure is not None :
1539- raise ValueError ("rolling apply kernel functions cannot have closure variables" )
1540- if func_node .defaults is not None :
1541- raise ValueError ("rolling apply kernel functions cannot have default arguments" )
15421532 # create a function from the code object
15431533 glbs = self .state .func_ir .func_id .func .__globals__
15441534 lcs = {}
15451535 exec ("def f(A): return A" , glbs , lcs )
15461536 kernel_func = lcs ['f' ]
1547- kernel_func .__code__ = func_node .code
1548- kernel_func .__name__ = func_node .code .co_name
1537+ kernel_func .__code__ = func_node .__code__
1538+ kernel_func .__name__ = func_node .__code__ .co_name
15491539 # use hpat's sequential pipeline to enable pandas operations
15501540 # XXX seq pipeline used since dist pass causes a hang
15511541 m = numba .ir_utils ._max_label
0 commit comments