Closed Octogonapus closed 2 years ago
Ok so the approach looks fine, but indeed there is a bug in getting the truthiness of a wrapped Julia value, which I'll fix.
You can also pass pyfunc(f)
instead of the function f
. The difference is that the arguments passed to pyfunc(f)
are always Py
(which is normally appropriate for callback functions) whereas the arguments to f
are converted first. As a handy side effect, pyfunc(f)
shouldn't have the truthy bug.
I'll need a MWE if you want me to look at the segfaults.
Thanks, the pyfunc
method works.
As for the segfault, I'm happy to provide the full code, though it relies on you having certain AWS resources. Not sure if you want to provision those. If you don't, I'm also happy to grant you access to my resources so that you can test with them. I'd want to transfer the details in a secure way, of course. Let me know if either option interests you.
Closing as the main issue is fixed. Feel free to open an issue if you're still having those segfaults.
I need to pass some Julia functions as callbacks to a Python function. I've scoured the documentation but I can't figure out how to pass callbacks to Python.
My code:
The error I get:
This is the Python code of my dependency:
I can change
if callback:
toif callback is not None:
for the same effect, though 1) I don't want to start maintaining patches for my dependencies and 2) this method of passing callbacks leads to segfaults later on when they are invoked, so I think I am just doing something wrong.