Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing functions to Julia as global variables is buggy #394

Closed
LilithHafner opened this issue Oct 30, 2023 · 1 comment
Closed

Passing functions to Julia as global variables is buggy #394

LilithHafner opened this issue Oct 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@LilithHafner
Copy link
Contributor

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
@LilithHafner LilithHafner added the bug Something isn't working label Oct 30, 2023
cjdoris pushed a commit that referenced this issue Oct 31, 2023
@cjdoris
Copy link
Collaborator

cjdoris commented Oct 31, 2023

Thanks - fixed on 'main'.

@cjdoris cjdoris closed this as completed Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants