windbg crashes at script end: "PyThreadState_Delete: tstate is still current"
I might be setting things up incorrectly, but every time I run any Python script, when the script is finished, the debugger crashes.
Fatal Python error: PyThreadState_Delete: tstate is still current
I downloaded the latest bootstrapper and installed the pykd module via pip. I set PYTHONHOME. The script engine (this issue aside) works great. It just kills the debugger at the end.
> cdb -z test.dmp
.load pykd
.load path\to\python\Lib\site-packages\pykd\pykd.pyd
!py test.py
test.py
from pykd import *
dprintln('Hello World')
I was trying to get this to work with a Python 3.7.1 WinPython, but I also tried it with 3.8.3 (WinPython) and Anaconda 2 (2.7.16) and 3 (3.7.6) (all 32-bit). Same results. It crashes in both windbg and cdb (10.0.17134.12 x86).
I also tried some of the python scripts in windbg-extensions, like heap_stat.py
with the same result: the script runs fine but crashes the debugger when it's finished.
Am I doing something wrong? The (google translated) docs provide some info, but not a thorough discussion of how to set up an environment.