Replies: 1 comment 1 reply
-
I think the issue is that julia> @macroexpand @py 1+2
quote
#= REPL[11]:1 =#
if (Base.RefValue{Bool}(true))[]
(PythonCall.pycopy!)(<py NULL>, (PythonCall.pynew)((Py)(2)))
(PythonCall.pycopy!)(<py NULL>, (PythonCall.pynew)((Py)(1)))
(Base.RefValue{Bool}(true))[] = false
end
var"##x#320" = <py NULL>
var"##y#321" = <py NULL>
var"##ans#319" = (PythonCall.pyadd)(var"##x#320", var"##y#321")
var"##ans#319"
end Doing it this way expands the marco on the worker, which seems to be fine julia> pmap(1:2) do i
@eval @py 1+2
nothing
end
2-element Vector{Nothing}:
nothing
nothing Don't know if its worth doing anything. The macro could expand to a function call which returns PyNull rather than pasting the object in there? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to pmap over a simple Python function, not trying to move any Python objects between processes or any intercommunication otherwise, but getting a segfault. Is this supposed to work? Or a way to make it work?
Julia 1.9.3, PythonCall 0.9.14, python 3.11.5.
Beta Was this translation helpful? Give feedback.
All reactions