[Bf-python] Py_GetVersion() vs PY_VERSION

Ken Hughes khughes at pacific.edu
Tue Mar 20 23:49:23 CET 2007


After upgrading to Python 2.5 here (as in compile from source), I 
discovered I was getting this when Blender started:

Compiled with Python version 2.5 (.

This is because Blender's start-up message prints the first five char of 
the Py_GetVersion(), which is this on my system:

 >>> sys.version
'2.5 (r25:51908, Mar 20 2007, 14:50:59) \n[GCC 4.0.3 (Ubuntu 
4.0.3-1ubuntu5)]'

I started making changes to only print up to the first space in the 
string, but then thought "why don't we use the value of PY_VERSION 
defined in Python.h?".

But I start to get confused; is the version check looking at the 
*compiled function* or the *runtime library*?  If it's the former, then 
I think PY_VERSION should be OK.  If it's the latter, then it's 
obviously not (but then we should be testing for that compatibility 
somewhere too).

Ken



More information about the Bf-python mailing list