You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which wraps the variable x into a ctypes.c_int32(x) wrapper. In that wrapper, the value gets updated, but this updated value will not propagate back to x itself, since in Python the semantics does not allow that.
If we want to support this feature, we would need to do something like this:
And the target creates the wrapper class, that overloads the = operator (if it is allowed) and x=5 then puts it into the wrapper. Then pointer(x, i32) should be able to update this wrapper. This is really quite hackish, and almost does not seem worth doing.
A better approach might be to use a numpy array, and make CPtr point to the first element. Then I think the first element should update.
All these C interop things are meant to be used when interacting with C, and one can create a small Python function to hide this in it. And if we have the freedom to design the C interface, it's better to return the integer as a result of the function, then there is no problem.
Activity
certik commentedon Jun 21, 2022
To fix this issue, let's add the workaround using a numpy array as a test in our integration_tests, using cpython, llvm and c.