summaryrefslogtreecommitdiff
path: root/weave/inline_tools.py
diff options
context:
space:
mode:
authorEric Jones <eric@enthought.com>2002-01-17 01:43:04 +0000
committerEric Jones <eric@enthought.com>2002-01-17 01:43:04 +0000
commitec1bba279c2b78aa7192a1b047e426b917ac9479 (patch)
treef6940a88f9b62785b6aba49c37fa0181330dbd51 /weave/inline_tools.py
parent79cd95adf1c70d464b266d1fd84e1d98781117b1 (diff)
downloadnumpy-ec1bba279c2b78aa7192a1b047e426b917ac9479.tar.gz
added keyword arguments to blitz() so that it can handle distutils arguments just like inline()
converted all exceptions to call throw_error(). throw_error(exception,msg) will set the Python exception values and then through an integer exception. This is the only one that seems to work on Mandrake. Gordon McMillan says it happens on other platforms also when the python has been linked with a C compiler instead of a C++ compiler (which is almost always the case).
Diffstat (limited to 'weave/inline_tools.py')
-rw-r--r--weave/inline_tools.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/weave/inline_tools.py b/weave/inline_tools.py
index d86b57afd..7b0e3ed78 100644
--- a/weave/inline_tools.py
+++ b/weave/inline_tools.py
@@ -96,11 +96,11 @@ class inline_ext_function(ext_tools.ext_function):
' /*I would like to fill in changed ' \
'locals and globals here...*/ \n' \
'\n} \n'
- catch_code = "catch( Py::Exception& e) \n" \
+ catch_code = "catch(...) \n" \
"{ \n" + \
" return_val = Py::Null(); \n" \
" exception_occured = 1; \n" \
- "} \n"
+ "} \n"
return_code = " /* cleanup code */ \n" + \
cleanup_code + \
" if(!return_val && !exception_occured)\n" \
@@ -296,9 +296,14 @@ def inline(code,arg_names=[],local_dict = None, global_dict = None,
try:
results = apply(function_cache[code],(local_dict,global_dict))
return results
- except:
+ except TypeError, msg: # should specify argument types here.
+ msg = str(msg)
+ if msg[:16] == "Conversion Error":
+ pass
+ else:
+ raise TypeError, msg
+ except KeyError:
pass
-
# 2. try function catalog
try:
results = attempt_function_call(code,local_dict,global_dict)