-1

I am trying to import a C-API Python module for a game (Assetto Corsa) that uses Python 3.3.5 as scripting extension. I am using MSVC 10.0 as described here for building the extension which works fine. Importing the produced *.pyd file works in the terminal (using Python 3.3.5) and as well in the game when the script is called. However, instantiating a class object works only in the terminal but leads to a crash when executing it in the game.

By logging all the executed statements I know that the constructor in the C-API is called correctly, so the problem must lie somewhere else. I think that posting all the code might be too much, and as I said, it works as expected.

Does anybody have an idea, what might be wrong?

The target platform is obviously Windows.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
chriszo
  • 1
  • 1
  • 4

1 Answers1

-1

I solved the problem myself, however, I am not sure what was the cause. Removing the garbage collection flag 'Py_TPFLAGS_HAVE_GC' and the function pointer to the destructor from the 'PyTypeObject' description did the trick. Be careful, this might lead to a memory leak! :)

chriszo
  • 1
  • 1
  • 4