-
Notifications
You must be signed in to change notification settings - Fork 188
Description
In Julia 0.6 master, I can successfully convert an ordinary function like sum and call it from Python: PyObject(sum)(3) works (and returns 3).
However, the same code no longer works for anonymous functions: PyObject(x -> x+1)(3) fails. I inserted some println statements into the callback hook, and I verified that f = unsafe_pyjlwrap_to_objref(self_)::Function is successfully getting a reference to f = x -> x+1 (display(f) gives the expected output). However, for some reasons f(3) is then throwing a MethodError.
@vtjnash, @yuyichao, has something changed at a low-level with Function objects, e.g. the new dependency-tracking stuff, that would break this?
(I'm stashing a jl_value_t* pointer in the Python object and pulling it out in the callback to call; a reference to the function object is saved in a global dictionary to prevent it from being garbage-collected.)