Skip to content

Commit 4ff3ebd

Browse files
committed
fix #95: pointers to immutable structures must be passed via arrays, not via &
1 parent 93fad5c commit 4ff3ebd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/callback.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ function pymethod(f::Function, name::AbstractString, flags::Integer)
1313
# Python expects the PyMethodDef structure to be a *constant*,
1414
# so we define an anonymous global to hold it.
1515
def = gensym("PyMethodDef")
16-
@eval const $def = PyMethodDef($name, $f, $flags)
16+
@eval const $def = PyMethodDef[PyMethodDef($name, $f, $flags)]
1717
PyObject(@pycheckn ccall((@pysym :PyCFunction_NewEx), PyPtr,
1818
(Ptr{PyMethodDef}, Ptr{Void}, Ptr{Void}),
19-
&eval(def), C_NULL, C_NULL))
19+
eval(def), C_NULL, C_NULL))
2020
end
2121

2222
################################################################

0 commit comments

Comments
 (0)