cleanup globals: declare as const where possible and initialize in pyinitialize, move all cfunctions into pyinitialize for safe precompilation, and fix incorrect usage of pyversion before it was assigned (fix #103)