Message 71143 - Python tracker
Good catch! Indeed, when PyString_FromString or PyUnicode_FromWideChar fail, Python crashes with Fatal Python error: PyThreadState_Get: no current thread in a debug build, and an access violation in a release build (tested on Windows). Also, your patch suggestion is absolutely correct and fixes the problem.