Fix apply_along_axis for functions returning Python objects