diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2007-02-10 03:20:57 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2007-02-10 03:20:57 +0000 |
commit | 62a37c60ddce222ff2968b21e47a77c5a854c657 (patch) | |
tree | b19b40f76335426d84fd2d8216f9c7bb56e866eb /externals/grill/py/source | |
parent | 486cb8958d1a99a3cbe98e3904256e7268533b00 (diff) |
fixing numpy initialization quirks
svn path=/trunk/; revision=7416
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r-- | externals/grill/py/source/pybuffer.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp index c375aa63..5452c254 100644 --- a/externals/grill/py/source/pybuffer.cpp +++ b/externals/grill/py/source/pybuffer.cpp @@ -2,7 +2,7 @@ py/pyext - python script object for PD and Max/MSP -Copyright (c)2002-2006 Thomas Grill (gr@grrrr.org) +Copyright (c)2002-2007 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -761,16 +761,21 @@ PyTypeObject pySamplebuffer_Type = { buffer_new, /* tp_new */ }; -void initsamplebuffer() +// Must have this as a function because the import_array macro in numpy version 1.01 strangely has a return statement included. +// Furthermore the import error printout from this macro is ugly, but we accept that for more, waiting for later numpy updates to fix all of this. +static void __import_array__() { - PyErr_Clear(); - -#ifdef PY_ARRAYS #ifdef PY_NUMARRAY import_libnumarray(); #else - import_array(); + import_array(); #endif +} + +void initsamplebuffer() +{ +#ifdef PY_ARRAYS + __import_array__(); if(PyErr_Occurred()) // catch import error PyErr_Clear(); |