@@ -1212,7 +1212,10 @@ 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 ]).value .py_func
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" )
12161219
12171220 dtype = self .state .typemap [series_var .name ].dtype
12181221 nodes = []
@@ -1379,7 +1382,11 @@ def _handle_series_combine(self, assign, lhs, rhs, series_var):
13791382 raise ValueError ("not enough arguments in call to combine" )
13801383 if len (rhs .args ) > 3 :
13811384 raise ValueError ("too many arguments in call to combine" )
1382- func = guard (get_definition , self .state .func_ir , rhs .args [1 ]).value .py_func
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+
13831390 out_typ = self .state .typemap [lhs .name ].dtype
13841391 other = rhs .args [0 ]
13851392 nodes = []
@@ -1526,16 +1533,19 @@ def f(arr, w, center): # pragma: no cover
15261533 def _handle_rolling_apply_func (self , func_node , dtype , out_dtype ):
15271534 if func_node is None :
15281535 raise ValueError ("cannot find kernel function for rolling.apply() call" )
1529- func_node = func_node .value .py_func
15301536 # TODO: more error checking on the kernel to make sure it doesn't
15311537 # 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" )
15321542 # create a function from the code object
15331543 glbs = self .state .func_ir .func_id .func .__globals__
15341544 lcs = {}
15351545 exec ("def f(A): return A" , glbs , lcs )
15361546 kernel_func = lcs ['f' ]
1537- kernel_func .__code__ = func_node .__code__
1538- kernel_func .__name__ = func_node .__code__ .co_name
1547+ kernel_func .__code__ = func_node .code
1548+ kernel_func .__name__ = func_node .code .co_name
15391549 # use hpat's sequential pipeline to enable pandas operations
15401550 # XXX seq pipeline used since dist pass causes a hang
15411551 m = numba .ir_utils ._max_label
0 commit comments