[Bf-python] Py_GetVersion() vs PY_VERSION

Stephen Swaney sswaney at centurytel.net
Wed Mar 21 03:46:42 CET 2007


On Tue, Mar 20, 2007 at 03:49:23PM -0700, Ken Hughes wrote:
> 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).

Printing 5 chars was a quick hack with 2.4.x to get the minor version
number since there were some apparent version incompatibilities.

Py_GetVersion is using the #define PY_VERSION so that *should* be ok.
I can't offhand think of a circumstance where it would not be.

Since we have seen some issues with dueling compiler versions
( Suse 10 comes to mind ), maybe we should just print the whole
Py_GetVersion() string and be done with it.

-- 
Stephen Swaney			
sswaney at centurytel.net




More information about the Bf-python mailing list