On 07Aug2017 2231, Patrick Rutkowski wrote:
So, it seems to be the case that picking a mismatched python binary causes the crash, __but only with python3, not with python36__. This makes me wonder what the differences is between the two in the first place. I was getting the crash to begin with because I was linking my Debug build with the release build python3.lib, since I thought it shouldn't matter.
My problem is fixed now, but if anyone could sheld light on the details of why exactly it happened then I would certainy be interested.
I'd love to be able to, but honestly I have basically no idea. There is only one implementation of PyThreadState_Get() (which is what the PyThreadState_GET macro should map to), and that should never return NULL without terminating the entire process. My best guess is that the API forwarding being done by python3.dll is failing somehow and is turning into a function that returns 0. Since you are embedding rather than building an extension module, I'd suggest linking directly to python36[_d].dll, since you will presumably be including the Python runtime with your application (this is exactly the use case for the embeddable package, in case you hadn't seen that). The python3[_d].dll is most useful when building a .pyd that may be used with multiple versions of Python 3. It has some limitations and many bugs though, which I don't know we can ever fully resolve, but all of which can be avoided in your case by not using it :) Hope that helps, Steve