Closed levy closed 2 years ago
Not sure yet where exactly the problem is, but a workaround is to not rely on implicit conversion of dict
-> std::map
:
o = cppyy.gbl.std.map({"a": "b"})
Indeed, this workaround fixes the problem. I also have Python list to std::vector implicit conversion, but once I make them explicit they work too.
Same problem, same fix as #62.
Aside, the reason why the problem cropped up more with the implicit conversion, is because that is done through Python API calls: both to get the data out of the dict
and into the std::map
. With these extra calls, there's a higher chance that threads will be switched while still mid-call. Otherwise, the C++ portion of the bindings is just 1 "Python instruction" and threads don't switch during it.
Released with 2.4.0 and its dependencies.
I want to start with saying that this tool is so nice that it feels like it's cheating.
Anyway, my guess for this one is that there's a threading issue while the wrapper code is being genarated?!
pip3 list:
test.h:
test.cc:
test.py:
compile:
run:
Please note that the function takes 2 arguments and it is called with 2 arguments. This error doesn't always come up, only if multiple threads are used, and even then it only pops up occasionally.