From 03c7468fcc51888c8271b904e4d6400ed5c1cbb1 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 7 Mar 2007 13:40:14 +0000 Subject: multiply inlets for py (hot and cold inlets) small optimizations and fixes use PyGILState_\*() functionality (enabled with PY_USE_GIL) updates for DSP processing __str__ method for pyext, to enable print self calls added message bundle functionality (pyext.Bundle class) enable compiled-only scripts (without .py) enable optimization of Python code in reease build let _inlets and _outlets default to 0 fix for numpy some ASSERTs for explicitly created pyext classes (should be runtime checks i guess) open editor for script under OS X fixing numpy initialization quirks enable symbol binding for all callables (not only functions and methods) _isthreaded is now a data member instead of a method fix for gcc4 added pyext._list and pyext._tuple to convert input lists to Python sequence objects enable module packages (module/__init__.py[co]), now also for Max python-like dotted module.function syntax cleaned up float vs. int pyext tags compiler flag to exclude DSP objects some optimizations and py reload fix more safety for calls where association python-pd has already been removed always run Python interpreter in the background svn path=/trunk/; revision=7474 --- externals/grill/py/source/pyext.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'externals/grill/py/source/pyext.cpp') diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp index 5c573bd2..31945277 100644 --- a/externals/grill/py/source/pyext.cpp +++ b/externals/grill/py/source/pyext.cpp @@ -117,8 +117,10 @@ pyext::pyext(int argc,const t_atom *argv,bool sig): methname(NULL), pyobj(NULL), inlets(-1),outlets(-1), - siginlets(0),sigoutlets(0), - pythr(NULL) + siginlets(0),sigoutlets(0) +#ifndef PY_USE_GIL + ,pythr(NULL) +#endif { #ifdef FLEXT_THREADS FLEXT_ADDTIMER(stoptmr,tick); @@ -141,7 +143,7 @@ pyext::pyext(int argc,const t_atom *argv,bool sig): // check if the object name is pyext. , pyx. or similar bool dotted = strrchr(thisName(),'.') != NULL; - PyThreadState *state = PyLockSys(); + ThrState state = PyLockSys(); // init script module if(argc) { @@ -194,7 +196,7 @@ pyext::pyext(int argc,const t_atom *argv,bool sig): bool pyext::Init() { - PyThreadState *state = PyLockSys(); + ThrState state = PyLockSys(); if(methname) { MakeInstance(); @@ -221,7 +223,7 @@ void pyext::Exit() { pybase::Exit(); // exit threads - PyThreadState *state = PyLockSys(); + ThrState state = PyLockSys(); DoExit(); Unregister(GetRegistry(REGNAME)); @@ -414,7 +416,7 @@ void pyext::Unload() void pyext::m_get(const t_symbol *s) { - PyThreadState *state = PyLockSys(); + ThrState state = PyLockSys(); PyObject *pvar = PyObject_GetAttrString(pyobj,const_cast(GetString(s))); /* fetch bound method */ if(pvar) { @@ -437,7 +439,7 @@ void pyext::m_get(const t_symbol *s) void pyext::m_set(int argc,const t_atom *argv) { - PyThreadState *state = PyLockSys(); + ThrState state = PyLockSys(); if(argc < 2 || !IsString(argv[0])) post("%s - Syntax: set varname arguments...",thisName()); @@ -542,7 +544,7 @@ bool pyext::work(int n,const t_symbol *s,int argc,const t_atom *argv) { bool ret = false; - PyThreadState *state = PyLock(); + ThrState state = PyLock(); // should be enough... char str[256]; -- cgit v1.2.1