From 4eb1464e5439332693a92ab76776b06d9b0c8700 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 26 Sep 2005 13:59:59 +0000 Subject: __str__ method for pyext, to enable print self calls enable symbol binding for all callables (not only functions and methods) enable optimization of Python code in reease build _isthreaded is now a data member instead of a method compiler flag to exclude DSP objects some cleanups pyext: fix for missing __init__ attribute some optimizations and py reload fix some ASSERTs for explicitly created pyext classes (should be runtime checks i guess) more safety for calls where association python-pd has already been removed fixed typos let _inlets and _outlets default to 0 svn path=/trunk/; revision=3637 --- externals/grill/py/gpl.txt | 62 ----- externals/grill/py/py.xcode/project.pbxproj | 363 ++++++++++++++++++++++++++-- externals/grill/py/readme.txt | 2 +- externals/grill/py/source/pybase.cpp | 41 +--- externals/grill/py/source/pybase.h | 20 +- externals/grill/py/source/pybuffer.h | 128 +++++----- externals/grill/py/source/pyext.cpp | 2 + externals/grill/py/source/pysymbol.h | 2 +- 8 files changed, 446 insertions(+), 174 deletions(-) (limited to 'externals/grill') diff --git a/externals/grill/py/gpl.txt b/externals/grill/py/gpl.txt index 5ea29a7d..d712e5d9 100644 --- a/externals/grill/py/gpl.txt +++ b/externals/grill/py/gpl.txt @@ -282,65 +282,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - diff --git a/externals/grill/py/py.xcode/project.pbxproj b/externals/grill/py/py.xcode/project.pbxproj index d6d17c21..e35194df 100644 --- a/externals/grill/py/py.xcode/project.pbxproj +++ b/externals/grill/py/py.xcode/project.pbxproj @@ -18,6 +18,7 @@ projectDirPath = ""; targets = ( E90E52E508092505001341AC, + E926B6D2089F75950034D534, ); }; 089C166AFE841209C02AAC07 = { @@ -25,6 +26,7 @@ 08FB77ADFE841716C02AAC07, 089C1671FE841209C02AAC07, 19C28FB4FE9D528D11CA2CBB, + E926B6D4089F75950034D534, ); isa = PBXGroup; name = py; @@ -33,9 +35,14 @@ }; 089C1671FE841209C02AAC07 = { children = ( + E97CEC9508E803C600535D83, + E97CEBE008E8039F00535D83, + E926B819089F78400034D534, + E926B817089F782F0034D534, + E926B815089F77F10034D534, + E926B813089F77DE0034D534, E90E52D208091F79001341AC, E90E521108091CA5001341AC, - E90E51FD08091A06001341AC, E90E51FB080919EC001341AC, ); isa = PBXGroup; @@ -85,6 +92,7 @@ 19C28FB4FE9D528D11CA2CBB = { children = ( E90E52E608092505001341AC, + E926B6D3089F75950034D534, ); isa = PBXGroup; name = Products; @@ -110,6 +118,7 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = "$(GCC_PREPROCESSOR_DEFINITIONS) FLEXT_DEBUG"; + LIBRARY_STYLE = STATIC; OPTIMIZATION_CFLAGS = "-O0"; ZERO_LINK = YES; }; @@ -362,14 +371,6 @@ refType = 0; sourceTree = ""; }; - E90E51FD08091A06001341AC = { - isa = PBXFileReference; - lastKnownFileType = archive.ar; - name = "libflext-pd_t.a"; - path = "/usr/local/lib/libflext-pd_t.a"; - refType = 0; - sourceTree = ""; - }; E90E521108091CA5001341AC = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; @@ -425,9 +426,9 @@ buildActionMask = 2147483647; files = ( E90E535B08092593001341AC, - E90E535C08092593001341AC, E90E535D08092593001341AC, E90E535E08092593001341AC, + E97CEC9608E803C600535D83, ); isa = PBXFrameworksBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -462,7 +463,7 @@ dependencies = ( ); isa = PBXNativeTarget; - name = py; + name = py.pd_darwin; productName = py; productReference = E90E52E608092505001341AC; productType = "com.apple.product-type.library.dynamic"; @@ -577,24 +578,354 @@ settings = { }; }; - E90E535C08092593001341AC = { - fileRef = E90E51FD08091A06001341AC; + E90E535D08092593001341AC = { + fileRef = E90E521108091CA5001341AC; isa = PBXBuildFile; settings = { }; }; - E90E535D08092593001341AC = { - fileRef = E90E521108091CA5001341AC; + E90E535E08092593001341AC = { + fileRef = E90E52D208091F79001341AC; isa = PBXBuildFile; settings = { }; }; - E90E535E08092593001341AC = { + E926B6CF089F75950034D534 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + E926B6D0089F75950034D534 = { + buildActionMask = 2147483647; + files = ( + E926B6D8089F76D90034D534, + E926B6D9089F76D90034D534, + E926B6DA089F76D90034D534, + E926B6DB089F76D90034D534, + E926B6DC089F76D90034D534, + E926B6DD089F76D90034D534, + E926B6DE089F76D90034D534, + E926B6DF089F76D90034D534, + E926B6E0089F76D90034D534, + E926B6E1089F76D90034D534, + E926B6E2089F76D90034D534, + E926B6E3089F76D90034D534, + E926B6E4089F76D90034D534, + E926B6E5089F76D90034D534, + E926B6E6089F76D90034D534, + E926B6E7089F76D90034D534, + E926B6E8089F76D90034D534, + E926B6E9089F76D90034D534, + E926B6EA089F76D90034D534, + E926B6EB089F76D90034D534, + E926B6EC089F76D90034D534, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + E926B6D1089F75950034D534 = { + buildActionMask = 2147483647; + files = ( + E926B833089F7CB50034D534, + E926B7B6089F77B90034D534, + E926B6F4089F77B20034D534, + E926B818089F782F0034D534, + E926B81A089F78400034D534, + E97CEBE108E803A000535D83, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + E926B6D2089F75950034D534 = { + buildPhases = ( + E926B6CF089F75950034D534, + E926B6D0089F75950034D534, + E926B6D1089F75950034D534, + ); + buildRules = ( + ); + buildSettings = { + GCC_ALTIVEC_EXTENSIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = source/pyprefix.h; + GCC_PREPROCESSOR_DEFINITIONS = "FLEXT_SYS=1 FLEXT_THREADS"; + GENERATE_PKGINFO_FILE = YES; + HEADER_SEARCH_PATHS = "/usr/local/include/flext \"/Users/thomas/Develop/MaxMSP-SDK/4.5 Headers/c74support/max-includes\" \"/Users/thomas/Develop/MaxMSP-SDK/4.5 Headers/c74support/msp-includes\""; + INFOPLIST_FILE = "py-Info.plist"; + LIBRARY_SEARCH_PATHS = "\"/Users/thomas/Develop/MaxMSP-SDK/4.5 headers/c74support/max-includes\" \"/Users/thomas/Develop/MaxMSP-SDK/4.5 headers/c74support/msp-includes\""; + OTHER_CFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = py; + SECTORDER_FLAGS = ""; + SKIP_INSTALL = YES; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + WRAPPER_EXTENSION = mxo; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = py; + productName = py; + productReference = E926B6D3089F75950034D534; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + py + CFBundleIdentifier + com.yourcompany.py + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CSResourcesFileMapped + yes + + +"; + productType = "com.apple.product-type.bundle"; + }; + E926B6D3089F75950034D534 = { + explicitFileType = wrapper.cfbundle; + includeInIndex = 0; + isa = PBXFileReference; + path = py.mxo; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E926B6D4089F75950034D534 = { + isa = PBXFileReference; + lastKnownFileType = text.xml; + name = "py-Info.plist"; + path = "/Users/thomas/Develop/pdmax/py/py-Info.plist"; + refType = 0; + sourceTree = ""; + }; + E926B6D8089F76D90034D534 = { + fileRef = E90043820887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6D9089F76D90034D534 = { + fileRef = E90043830887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DA089F76D90034D534 = { + fileRef = E90043840887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DB089F76D90034D534 = { + fileRef = E90043850887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DC089F76D90034D534 = { + fileRef = E90043860887A302008AEAFC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DD089F76D90034D534 = { + fileRef = E90E51DB08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DE089F76D90034D534 = { + fileRef = E90E51DC08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6DF089F76D90034D534 = { + fileRef = E90E51DD08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E0089F76D90034D534 = { + fileRef = E90E51DE08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E1089F76D90034D534 = { + fileRef = E90E51DF08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E2089F76D90034D534 = { + fileRef = E90E51E008091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E3089F76D90034D534 = { + fileRef = E90E51E108091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E4089F76D90034D534 = { + fileRef = E90E51E208091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E5089F76D90034D534 = { + fileRef = E90E51E308091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E6089F76D90034D534 = { + fileRef = E90E51E408091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E7089F76D90034D534 = { + fileRef = E90E51E508091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E8089F76D90034D534 = { + fileRef = E90E51E608091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6E9089F76D90034D534 = { + fileRef = E90E51E708091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6EA089F76D90034D534 = { + fileRef = E90E51E808091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6EB089F76D90034D534 = { + fileRef = E90E51E908091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6EC089F76D90034D534 = { + fileRef = E90E51EA08091989001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B6F4089F77B20034D534 = { fileRef = E90E52D208091F79001341AC; isa = PBXBuildFile; settings = { }; }; + E926B7B6089F77B90034D534 = { + fileRef = E90E51FB080919EC001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E926B813089F77DE0034D534 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = MaxAPI.lib; + path = "/Users/thomas/Develop/MaxMSP-SDK/4.5 headers/c74support/max-includes/MaxAPI.lib"; + refType = 0; + sourceTree = ""; + }; + E926B815089F77F10034D534 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = MaxAudio.lib; + path = "/Users/thomas/Develop/MaxMSP-SDK/4.5 headers/c74support/msp-includes/MaxAudio.lib"; + refType = 0; + sourceTree = ""; + }; + E926B817089F782F0034D534 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = MaxAPI.framework; + path = /Library/Frameworks/MaxAPI.framework; + refType = 0; + sourceTree = ""; + }; + E926B818089F782F0034D534 = { + fileRef = E926B817089F782F0034D534; + isa = PBXBuildFile; + settings = { + }; + }; + E926B819089F78400034D534 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = MaxAudioAPI.framework; + path = /Library/Frameworks/MaxAudioAPI.framework; + refType = 0; + sourceTree = ""; + }; + E926B81A089F78400034D534 = { + fileRef = E926B819089F78400034D534; + isa = PBXBuildFile; + settings = { + }; + }; + E926B833089F7CB50034D534 = { + fileRef = E90E521108091CA5001341AC; + isa = PBXBuildFile; + settings = { + }; + }; + E97CEBE008E8039F00535D83 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = "libflext-max_td.a"; + path = "/usr/local/lib/libflext-max_td.0.5.1.a"; + refType = 0; + sourceTree = ""; + }; + E97CEBE108E803A000535D83 = { + fileRef = E97CEBE008E8039F00535D83; + isa = PBXBuildFile; + settings = { + }; + }; + E97CEC9508E803C600535D83 = { + isa = PBXFileReference; + lastKnownFileType = archive.ar; + name = "libflext-pd_td.a"; + path = "/usr/local/lib/libflext-pd_td.0.5.1.a"; + refType = 0; + sourceTree = ""; + }; + E97CEC9608E803C600535D83 = { + fileRef = E97CEC9508E803C600535D83; + isa = PBXBuildFile; + settings = { + }; + }; }; rootObject = 089C1669FE841209C02AAC07; } diff --git a/externals/grill/py/readme.txt b/externals/grill/py/readme.txt index 34be0a14..dcd10461 100644 --- a/externals/grill/py/readme.txt +++ b/externals/grill/py/readme.txt @@ -106,7 +106,7 @@ Version history: - CHG: _isthreaded is now a data member instead of a method - FIX: more safety for calls where association python-pd has already been removed - ADD: __str__ method for pyext, to enable print self calls -- CHG: enable symbol binding for all callables (not only functions and methods) +- ADD: enable symbol binding for all callables (not only functions and methods) 0.2.0: - ADD: handling of Python threads diff --git a/externals/grill/py/source/pybase.cpp b/externals/grill/py/source/pybase.cpp index 09fd8687..e68d9929 100644 --- a/externals/grill/py/source/pybase.cpp +++ b/externals/grill/py/source/pybase.cpp @@ -75,6 +75,7 @@ PyObject *pybase::builtins_obj = NULL; PyObject *pybase::builtins_dict = NULL; const t_symbol *pybase::sym_fint = NULL; +const t_symbol *pybase::sym_response = NULL; // ----------------------------------------------------------------------------------------------------------- @@ -83,8 +84,8 @@ void initsymbol(); void initsamplebuffer(); void pybase::lib_setup() -{ - post(""); +{ + post(""); post("------------------------------------------------"); post("py/pyext %s - python script objects",PY__VERSION); post("(C)2002-2005 Thomas Grill - http://grrrr.org/ext"); @@ -98,6 +99,16 @@ void pybase::lib_setup() // ------------------------------------------------------------- + sym_response = flext::MakeSymbol("response"); + +#if FLEXT_SYS == FLEXT_SYS_PD + sym_fint = sym_float; +#else + sym_fint = sym_int; +#endif + + // ------------------------------------------------------------- + Py_Initialize(); #ifdef FLEXT_DEBUG @@ -163,12 +174,6 @@ void pybase::lib_setup() initsamplebuffer(); PyModule_AddObject(module_obj,"Buffer",(PyObject *)&pySamplebuffer_Type); -#if FLEXT_SYS == FLEXT_SYS_PD - sym_fint = sym_float; -#else - sym_fint = sym_int; -#endif - // ------------------------------------------------------------- FLEXT_SETUP(pyobj); @@ -548,17 +553,6 @@ bool pybase::OutObject(flext_base *ext,int o,PyObject *obj) return false; } -static const t_symbol *sym_response = flext::MakeSymbol("response"); - -void pybase::Respond(bool b) -{ - if(respond) { - t_atom a; - SetBool(a,b); - DumpOut(sym_response,1,&a); - } -} - void pybase::Reload() { PyThreadState *state = PyLock(); @@ -725,15 +719,6 @@ void pybase::thrworker(thr_params *p) --th->thrcount; // \todo this should be atomic } -bool pybase::qucall(PyObject *fun,PyObject *args) -{ - FifoEl *el = qufifo.New(); - el->Set(this,fun,args); - qufifo.Put(el); - qucond.Signal(); - return true; -} - void pybase::quworker(thr_params *) { FifoEl *el; diff --git a/externals/grill/py/source/pybase.h b/externals/grill/py/source/pybase.h index 49eccbbc..59a1d062 100644 --- a/externals/grill/py/source/pybase.h +++ b/externals/grill/py/source/pybase.h @@ -81,7 +81,15 @@ protected: virtual void Unload() = 0; void OpenEditor(); - void Respond(bool b); + + void Respond(bool b) + { + if(respond) { + t_atom a; + SetBool(a,b); + DumpOut(sym_response,1,&a); + } + } void Report() { while(PyErr_Occurred()) PyErr_Print(); } @@ -158,7 +166,14 @@ protected: #ifdef FLEXT_THREADS static void thrworker(thr_params *data); - bool qucall(PyObject *fun,PyObject *args); + bool qucall(PyObject *fun,PyObject *args) + { + FifoEl *el = qufifo.New(); + el->Set(this,fun,args); + qufifo.Put(el); + qucond.Signal(); + return true; + } static void quworker(thr_params *); void erasethreads(); @@ -169,6 +184,7 @@ protected: #endif static const t_symbol *sym_fint; // float or int symbol, depending on native number message type + static const t_symbol *sym_response; static const t_symbol *getone(t_atom &at,PyObject *arg); static const t_symbol *getlist(t_atom *lst,PyObject *seq,int cnt,int offs = 0); diff --git a/externals/grill/py/source/pybuffer.h b/externals/grill/py/source/pybuffer.h index 1d59dd95..3889e563 100644 --- a/externals/grill/py/source/pybuffer.h +++ b/externals/grill/py/source/pybuffer.h @@ -1,52 +1,52 @@ -/* - -py/pyext - python script object for PD and Max/MSP - -Copyright (c)2002-2005 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. - -*/ - -#ifndef __PYBUFFER_H -#define __PYBUFFER_H - -#include - -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) -#error You need at least flext version 0.5.0 -#endif - -#if FLEXT_OS == FLEXT_OS_MAC -#include -#else -#include -#endif - - -#ifdef _MSC_VER - #ifdef PY_EXPORTS - #define PY_EXPORT __declspec(dllexport) - #else - #define PY_EXPORT __declspec(dllimport) - #endif -#else - #define PY_EXPORT -#endif - -typedef struct { - PyObject_HEAD - /* Type-specific fields go here. */ - const t_symbol *sym; - flext::buffer *buf; - flext::buffer::lock_t lock; - bool dirty; -} pySamplebuffer; - -PY_EXPORT extern PyTypeObject pySamplebuffer_Type; - +/* + +py/pyext - python script object for PD and Max/MSP + +Copyright (c)2002-2005 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. + +*/ + +#ifndef __PYBUFFER_H +#define __PYBUFFER_H + +#include + +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) +#error You need at least flext version 0.5.0 +#endif + +#if FLEXT_OS == FLEXT_OS_MAC +#include +#else +#include +#endif + + +#ifdef _MSC_VER + #ifdef PY_EXPORTS + #define PY_EXPORT __declspec(dllexport) + #else + #define PY_EXPORT __declspec(dllimport) + #endif +#else + #define PY_EXPORT +#endif + +typedef struct { + PyObject_HEAD + /* Type-specific fields go here. */ + const t_symbol *sym; + flext::buffer *buf; + flext::buffer::lock_t lock; + bool dirty; +} pySamplebuffer; + +PY_EXPORT extern PyTypeObject pySamplebuffer_Type; + #define pySamplebuffer_Check(op) PyObject_TypeCheck(op, &pySamplebuffer_Type) -#define pySamplebuffer_CheckExact(op) ((op)->ob_type == &PySamplebuffer_Type) +#define pySamplebuffer_CheckExact(op) ((op)->ob_type == &pySamplebuffer_Type) PY_EXPORT PyObject *pySamplebuffer_FromSymbol(const t_symbol *sym); @@ -61,19 +61,19 @@ inline PyObject *pySamplebuffer_FromString(PyObject *str) return pySamplebuffer_FromString(PyString_AsString(str)); } -inline const t_symbol *pySamplebuffer_AS_SYMBOL(PyObject *op) -{ - return ((pySamplebuffer *)op)->sym; -} - -inline const t_symbol *pySamplebuffer_AsSymbol(PyObject *op) -{ - return pySamplebuffer_Check(op)?pySamplebuffer_AS_SYMBOL(op):NULL; -} - -inline const char *pySamplebuffer_AS_STRING(PyObject *op) -{ - return flext::GetString(pySamplebuffer_AS_SYMBOL(op)); -} - -#endif +inline const t_symbol *pySamplebuffer_AS_SYMBOL(PyObject *op) +{ + return ((pySamplebuffer *)op)->sym; +} + +inline const t_symbol *pySamplebuffer_AsSymbol(PyObject *op) +{ + return pySamplebuffer_Check(op)?pySamplebuffer_AS_SYMBOL(op):NULL; +} + +inline const char *pySamplebuffer_AS_STRING(PyObject *op) +{ + return flext::GetString(pySamplebuffer_AS_SYMBOL(op)); +} + +#endif diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp index 633d4007..91be31e0 100644 --- a/externals/grill/py/source/pyext.cpp +++ b/externals/grill/py/source/pyext.cpp @@ -259,6 +259,8 @@ bool pyext::DoInit() } Py_DECREF(init); } + // __init__ has not been found - don't care + PyErr_Clear(); Py_DECREF(pargs); return ok; diff --git a/externals/grill/py/source/pysymbol.h b/externals/grill/py/source/pysymbol.h index e711f424..42f6765c 100644 --- a/externals/grill/py/source/pysymbol.h +++ b/externals/grill/py/source/pysymbol.h @@ -51,7 +51,7 @@ PY_EXPORT extern pySymbol *pySymbol_int; #define pySymbol_Check(op) PyObject_TypeCheck(op, &pySymbol_Type) -#define pySymbol_CheckExact(op) ((op)->ob_type == &PySymbol_Type) +#define pySymbol_CheckExact(op) ((op)->ob_type == &pySymbol_Type) PY_EXPORT PyObject *pySymbol_FromSymbol(const t_symbol *sym); -- cgit v1.2.1