Bypass Python exmples not supported by -builtin
Builtin classes as exceptions not supported, so don't run these aspects of the examples when using -builtin.
This commit is contained in:
parent
da394fae80
commit
808d4b4798
4 changed files with 34 additions and 6 deletions
|
|
@ -10,3 +10,12 @@
|
||||||
/* Let's just grab the original header file here */
|
/* Let's just grab the original header file here */
|
||||||
%include "example.h"
|
%include "example.h"
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
// The -builtin SWIG option results in SWIGPYTHON_BUILTIN being defined
|
||||||
|
#ifdef SWIGPYTHON_BUILTIN
|
||||||
|
bool is_python_builtin() { return true; }
|
||||||
|
#else
|
||||||
|
bool is_python_builtin() { return false; }
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,17 @@ try:
|
||||||
except RuntimeError,e:
|
except RuntimeError,e:
|
||||||
print e.args[0]
|
print e.args[0]
|
||||||
|
|
||||||
try:
|
if not example.is_python_builtin():
|
||||||
t.hosed()
|
try:
|
||||||
except example.Exc,e:
|
t.hosed()
|
||||||
print e.code, e.msg
|
except example.Exc,e:
|
||||||
|
print e.code, e.msg
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
t.hosed()
|
||||||
|
except BaseException,e:
|
||||||
|
# Throwing builtin classes as exceptions not supported (-builtin option)
|
||||||
|
print e
|
||||||
|
|
||||||
for i in range(1,4):
|
for i in range(1,4):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,12 @@
|
||||||
%template(doubleQueue) Queue<double>;
|
%template(doubleQueue) Queue<double>;
|
||||||
|
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
// The -builtin SWIG option results in SWIGPYTHON_BUILTIN being defined
|
||||||
|
#ifdef SWIGPYTHON_BUILTIN
|
||||||
|
bool is_python_builtin() { return true; }
|
||||||
|
#else
|
||||||
|
bool is_python_builtin() { return false; }
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
# file: runme.py
|
# file: runme.py
|
||||||
import example
|
import example
|
||||||
|
|
||||||
|
if example.is_python_builtin():
|
||||||
|
print "Skipping example: -builtin option does not support %exceptionclass"
|
||||||
|
exit(0)
|
||||||
|
|
||||||
q = example.intQueue(10)
|
q = example.intQueue(10)
|
||||||
|
|
||||||
print "Inserting items into intQueue"
|
print "Inserting items into intQueue"
|
||||||
|
|
||||||
|
print type(example.FullError)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for i in range(0,100):
|
for i in range(0,100):
|
||||||
q.enqueue(i)
|
q.enqueue(i)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue