Closed
Description
Affects: JuliaCall
Describe the bug
Passing functions to Julia as global variables is buggy
>>> from juliacall import Main
>>> Main.x = 5
>>> Main.x # Fine
5
>>> def f(y):
... return y + 1
...
>>> Main.f = f
>>> Main.f # Bad
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/x/.julia/packages/PythonCall/qTEA1/src/jlwrap/any.jl", line 195, in __getattr__
return self._jl_callmethod($(pyjl_methodnum(pyjlany_getattr)), k)
^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: <built-in method _jl_callmethod of ModuleValue object at 0x103dc7a00> returned NULL without setting an exception
>>> Main.z = 7
>>> Main.z
7
>>> Main.f # Very bad
7
>>> Main.x
5