Final merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12595 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
0cdf8658c7
9 changed files with 114 additions and 165 deletions
|
|
@ -526,8 +526,6 @@ wallkw.cpptest: SWIGOPT += -Wallkw
|
||||||
preproc_include.ctest: SWIGOPT += -includeall
|
preproc_include.ctest: SWIGOPT += -includeall
|
||||||
|
|
||||||
|
|
||||||
NOT_BROKEN_C_TEST_CASES = $(C_TEST_CASES:=.ctest)
|
|
||||||
|
|
||||||
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
|
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
|
||||||
$(C_TEST_CASES:=.ctest) \
|
$(C_TEST_CASES:=.ctest) \
|
||||||
$(MULTI_CPP_TEST_CASES:=.multicpptest) \
|
$(MULTI_CPP_TEST_CASES:=.multicpptest) \
|
||||||
|
|
@ -549,8 +547,6 @@ all: $(BROKEN_TEST_CASES) $(NOT_BROKEN_TEST_CASES)
|
||||||
|
|
||||||
check: $(NOT_BROKEN_TEST_CASES)
|
check: $(NOT_BROKEN_TEST_CASES)
|
||||||
|
|
||||||
check-c : $(NOT_BROKEN_C_TEST_CASES)
|
|
||||||
|
|
||||||
# partialcheck target runs SWIG only, ie no compilation or running of tests (for a subset of languages)
|
# partialcheck target runs SWIG only, ie no compilation or running of tests (for a subset of languages)
|
||||||
partialcheck:
|
partialcheck:
|
||||||
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
|
$(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true
|
||||||
|
|
|
||||||
|
|
@ -1,124 +1,83 @@
|
||||||
import default_constructor
|
# This test is expected to fail with -builtin option.
|
||||||
|
# It uses the old static syntax (e.g., dc.new_A() rather than dc.A()),
|
||||||
|
# which is not provided with the -builtin option.
|
||||||
|
|
||||||
dc = default_constructor
|
import _default_constructor
|
||||||
|
|
||||||
# Old static syntax not supported
|
dc = _default_constructor
|
||||||
#a = dc.new_A()
|
|
||||||
#dc.delete_A(a)
|
|
||||||
a = dc.A()
|
|
||||||
del a
|
|
||||||
|
|
||||||
# Old static syntax not supported
|
a = dc.new_A()
|
||||||
#aa = dc.new_AA()
|
dc.delete_A(a)
|
||||||
#dc.delete_AA(aa)
|
|
||||||
aa = dc.AA()
|
aa = dc.new_AA()
|
||||||
del aa
|
dc.delete_AA(aa)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported
|
b = dc.new_B()
|
||||||
#b = dc.new_B()
|
|
||||||
b = dc.B()
|
|
||||||
print "Whoa. new_BB created."
|
print "Whoa. new_BB created."
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_b = dc.delete_B
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_b = dc.delete_B
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported.
|
bb = dc.new_BB();
|
||||||
#bb = dc.new_BB();
|
|
||||||
bb = dc.BB()
|
|
||||||
print "Whoa. new_BB created."
|
print "Whoa. new_BB created."
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_bb = dc.delete_BB
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_bb = dc.delete_BB
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported
|
c = dc.new_C()
|
||||||
#c = dc.new_C()
|
|
||||||
c = dc.C()
|
|
||||||
print "Whoa. new_C created."
|
print "Whoa. new_C created."
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_c = dc.delete_C
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_c = dc.delete_C
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
cc = dc.new_CC()
|
||||||
#cc = dc.new_CC()
|
dc.delete_CC(cc)
|
||||||
#dc.delete_CC(cc)
|
|
||||||
cc = dc.CC()
|
|
||||||
del cc
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported.
|
d = dc.new_D();
|
||||||
#d = dc.new_D();
|
|
||||||
d = dc.D()
|
|
||||||
print "Whoa. new_D created"
|
print "Whoa. new_D created"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_d = dc.delete_D
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_d = dc.delete_D
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported.
|
dd = dc.new_DD()
|
||||||
#dd = dc.new_DD()
|
|
||||||
dd = dc.DD()
|
|
||||||
print "Whoa. new_DD created"
|
print "Whoa. new_DD created"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
dd = dc.delete_DD
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#dd = dc.delete_DD
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported.
|
ad = dc.new_AD()
|
||||||
#ad = dc.new_AD()
|
|
||||||
ad = dc.AD()
|
|
||||||
print "Whoa. new_AD created"
|
print "Whoa. new_AD created"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_ad = dc.delete_AD
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_ad = dc.delete_AD
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
e = dc.new_E()
|
||||||
#e = dc.new_E()
|
dc.delete_E(e)
|
||||||
#dc.delete_E(e)
|
|
||||||
e = dc.E()
|
|
||||||
del e
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
ee = dc.new_EE()
|
||||||
#ee = dc.new_EE()
|
dc.delete_EE(ee)
|
||||||
#dc.delete_EE(ee)
|
|
||||||
ee = dc.EE()
|
|
||||||
del ee
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Old static syntax not supported.
|
eb = dc.new_EB()
|
||||||
#eb = dc.new_EB()
|
|
||||||
eb = dc.EB()
|
|
||||||
print "Whoa. new_EB created"
|
print "Whoa. new_EB created"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
del_eb = dc.delete_EB
|
||||||
# Swig builtin types have no tp_del entry (only tp_dealloc).
|
|
||||||
#del_eb = dc.delete_EB
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
f = dc.new_F()
|
||||||
#f = dc.new_F()
|
|
||||||
f = dc.F()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
del_f = dc.delete_F
|
del_f = dc.delete_F
|
||||||
|
|
@ -126,27 +85,18 @@ try:
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
dc.F_destroy(f)
|
||||||
#dc.F_destroy(f)
|
|
||||||
f.destroy()
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
|
||||||
#ff = dc.new_FFF()
|
|
||||||
ff = dc.FFF()
|
|
||||||
|
|
||||||
|
ff = dc.new_FFF()
|
||||||
try:
|
try:
|
||||||
del_ff = dc.delete_FFF
|
del_ff = dc.delete_FFF
|
||||||
print "Whoa. delete_FFF created"
|
print "Whoa. delete_FFF created"
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Old static syntax not supported.
|
dc.F_destroy(ff)
|
||||||
#dc.F_destroy(ff)
|
|
||||||
ff.destroy()
|
|
||||||
|
|
||||||
# Old static syntax not supported.
|
g = dc.new_G()
|
||||||
#g = dc.new_G()
|
|
||||||
g = dc.G()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
del_g = dc.delete_G
|
del_g = dc.delete_G
|
||||||
|
|
@ -154,13 +104,11 @@ try:
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
dc.G.destroy(g)
|
dc.G_destroy(g)
|
||||||
|
|
||||||
|
gg = dc.new_GG()
|
||||||
|
dc.delete_GG(gg)
|
||||||
|
|
||||||
# Old static syntax not supported.
|
|
||||||
#gg = dc.new_GG()
|
|
||||||
#dc.delete_GG(gg)
|
|
||||||
gg = dc.GG()
|
|
||||||
del gg
|
|
||||||
|
|
||||||
import default_constructor
|
import default_constructor
|
||||||
hh = default_constructor.HH(1,1)
|
hh = default_constructor.HH(1,1)
|
||||||
|
|
|
||||||
|
|
@ -66,14 +66,16 @@ except MyException, e:
|
||||||
if not ok:
|
if not ok:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
# This is expected to fail with -builtin option
|
||||||
# Throwing builtin classes as exceptions not supported
|
# Throwing builtin classes as exceptions not supported
|
||||||
#try:
|
try:
|
||||||
# raise Exception2()
|
raise Exception2()
|
||||||
#except Exception2:
|
except Exception2:
|
||||||
# pass
|
pass
|
||||||
|
|
||||||
|
# This is expected to fail with -builtin option
|
||||||
# Throwing builtin classes as exceptions not supported
|
# Throwing builtin classes as exceptions not supported
|
||||||
#try:
|
try:
|
||||||
# raise Exception1()
|
raise Exception1()
|
||||||
#except Exception1:
|
except Exception1:
|
||||||
# pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,23 @@
|
||||||
from exception_order import *
|
from exception_order import *
|
||||||
|
|
||||||
|
# This test is expected to fail with -builtin option.
|
||||||
|
# Throwing builtin classes as exceptions not supported
|
||||||
|
|
||||||
a = A()
|
a = A()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.foo()
|
a.foo()
|
||||||
# Throwing builtin classes as exceptions not supported
|
except E1,e:
|
||||||
#except E1,e:
|
|
||||||
# pass
|
|
||||||
except:
|
|
||||||
# raise RuntimeError, "bad exception order"
|
|
||||||
pass
|
pass
|
||||||
|
except:
|
||||||
|
raise RuntimeError, "bad exception order"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.bar()
|
a.bar()
|
||||||
# Throwing builtin classes as exceptions not supported
|
except E2,e:
|
||||||
#except E2,e:
|
|
||||||
# pass
|
|
||||||
except:
|
|
||||||
# raise RuntimeError, "bad exception order"
|
|
||||||
pass
|
pass
|
||||||
|
except:
|
||||||
|
raise RuntimeError, "bad exception order"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.foobar()
|
a.foobar()
|
||||||
|
|
@ -32,18 +30,14 @@ except RuntimeError,e:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.barfoo(1)
|
a.barfoo(1)
|
||||||
# Throwing builtin classes as exceptions not supported
|
except E1,e:
|
||||||
#except E1,e:
|
|
||||||
# pass
|
|
||||||
except:
|
|
||||||
# raise RuntimeError, "bad exception order"
|
|
||||||
pass
|
pass
|
||||||
|
except:
|
||||||
|
raise RuntimeError, "bad exception order"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.barfoo(2)
|
a.barfoo(2)
|
||||||
# Throwing builtin classes as exceptions not supported
|
except E2,e:
|
||||||
#except E2,e:
|
|
||||||
# pass
|
|
||||||
except:
|
|
||||||
# raise RuntimeError, "bad exception order"
|
|
||||||
pass
|
pass
|
||||||
|
except:
|
||||||
|
raise RuntimeError, "bad exception order"
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,16 @@ if a + b != "hello world":
|
||||||
if a + " world" != "hello world":
|
if a + " world" != "hello world":
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError, "bad string mapping"
|
||||||
|
|
||||||
|
# This is expected to fail with -builtin option
|
||||||
# Reverse operators not supported in builtin types
|
# Reverse operators not supported in builtin types
|
||||||
#if "hello" + b != "hello world":
|
if "hello" + b != "hello world":
|
||||||
# raise RuntimeError, "bad string mapping"
|
raise RuntimeError, "bad string mapping"
|
||||||
|
|
||||||
|
# This is expected to fail with -builtin option
|
||||||
# Reverse operators not supported in builtin types
|
# Reverse operators not supported in builtin types
|
||||||
#c = "hello" + b
|
c = "hello" + b
|
||||||
#if c.find_last_of("l") != 9:
|
if c.find_last_of("l") != 9:
|
||||||
# raise RuntimeError, "bad string mapping"
|
raise RuntimeError, "bad string mapping"
|
||||||
|
|
||||||
s = "hello world"
|
s = "hello world"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,21 @@ x=u"h"
|
||||||
|
|
||||||
if li_std_wstring.test_wcvalue(x) != x:
|
if li_std_wstring.test_wcvalue(x) != x:
|
||||||
print li_std_wstring.test_wcvalue(x)
|
print li_std_wstring.test_wcvalue(x)
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
x=u"hello"
|
x=u"hello"
|
||||||
if li_std_wstring.test_ccvalue(x) != x:
|
if li_std_wstring.test_ccvalue(x) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_cvalue(x) != x:
|
if li_std_wstring.test_cvalue(x) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_value(x) != x:
|
if li_std_wstring.test_value(x) != x:
|
||||||
print x, li_std_wstring.test_value(x)
|
print x, li_std_wstring.test_value(x)
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_const_reference(x) != x:
|
if li_std_wstring.test_const_reference(x) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
|
|
||||||
s = li_std_wstring.wstring(u"he")
|
s = li_std_wstring.wstring(u"he")
|
||||||
|
|
@ -26,41 +26,41 @@ s = s + u"llo"
|
||||||
|
|
||||||
if s != x:
|
if s != x:
|
||||||
print s, x
|
print s, x
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if s[1:4] != x[1:4]:
|
if s[1:4] != x[1:4]:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_value(s) != x:
|
if li_std_wstring.test_value(s) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_const_reference(s) != x:
|
if li_std_wstring.test_const_reference(s) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
a = li_std_wstring.A(s)
|
a = li_std_wstring.A(s)
|
||||||
|
|
||||||
if li_std_wstring.test_value(a) != x:
|
if li_std_wstring.test_value(a) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if li_std_wstring.test_const_reference(a) != x:
|
if li_std_wstring.test_const_reference(a) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
b = li_std_wstring.wstring(" world")
|
b = li_std_wstring.wstring(" world")
|
||||||
|
|
||||||
if a + b != "hello world":
|
if a + b != "hello world":
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
if a + " world" != "hello world":
|
if a + " world" != "hello world":
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
# With -builtin option, no reverse binary operators
|
# This is expected to fail if -builtin is used
|
||||||
#if "hello" + b != "hello world":
|
if "hello" + b != "hello world":
|
||||||
# raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
# With -builtin option, no reverse binary operators
|
# This is expected to fail if -builtin is used
|
||||||
#c = "hello" + b
|
c = "hello" + b
|
||||||
#if c.find_last_of("l") != 9:
|
if c.find_last_of("l") != 9:
|
||||||
# raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
s = "hello world"
|
s = "hello world"
|
||||||
|
|
||||||
|
|
@ -68,11 +68,11 @@ b = li_std_wstring.B("hi")
|
||||||
|
|
||||||
b.name = li_std_wstring.wstring(u"hello")
|
b.name = li_std_wstring.wstring(u"hello")
|
||||||
if b.name != "hello":
|
if b.name != "hello":
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
|
|
||||||
b.a = li_std_wstring.A("hello")
|
b.a = li_std_wstring.A("hello")
|
||||||
if b.a != u"hello":
|
if b.a != u"hello":
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
from python_abstractbase import *
|
from python_abstractbase import *
|
||||||
from collections import *
|
from collections import *
|
||||||
|
|
||||||
|
# This is expected to fail with -builtin option
|
||||||
# Builtin types can't inherit from pure-python abstract bases
|
# Builtin types can't inherit from pure-python abstract bases
|
||||||
#assert issubclass(Mapii, MutableMapping)
|
|
||||||
#assert issubclass(Multimapii, MutableMapping)
|
assert issubclass(Mapii, MutableMapping)
|
||||||
#assert issubclass(IntSet, MutableSet)
|
assert issubclass(Multimapii, MutableMapping)
|
||||||
#assert issubclass(IntMultiset, MutableSet)
|
assert issubclass(IntSet, MutableSet)
|
||||||
#assert issubclass(IntVector, MutableSequence)
|
assert issubclass(IntMultiset, MutableSet)
|
||||||
#assert issubclass(IntList, MutableSequence)
|
assert issubclass(IntVector, MutableSequence)
|
||||||
|
assert issubclass(IntList, MutableSequence)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ except:
|
||||||
if not err:
|
if not err:
|
||||||
raise RuntimeError, "A is not static"
|
raise RuntimeError, "A is not static"
|
||||||
|
|
||||||
|
|
||||||
class B(python_nondynamic.A):
|
class B(python_nondynamic.A):
|
||||||
c = 4
|
c = 4
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -21,13 +20,18 @@ class B(python_nondynamic.A):
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bb = B()
|
bb = B()
|
||||||
|
|
||||||
# This is questionable. Trying to set B.c? That's not what it does.
|
try:
|
||||||
# Should fail, I think, but it doesn't.
|
bb.c = 3
|
||||||
#bb.c = 3
|
err = 0
|
||||||
|
except:
|
||||||
|
err = 1
|
||||||
|
|
||||||
|
if not err:
|
||||||
|
print "bb.c = %d" % bb.c
|
||||||
|
print "B.c = %d" % B.c
|
||||||
|
raise RuntimeError, "B.c class variable messes up nondynamic-ness of B"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bb.d = 2
|
bb.d = 2
|
||||||
|
|
@ -37,7 +41,6 @@ except:
|
||||||
|
|
||||||
if not err:
|
if not err:
|
||||||
raise RuntimeError, "B is not static"
|
raise RuntimeError, "B is not static"
|
||||||
|
|
||||||
|
|
||||||
cc = python_nondynamic.C()
|
cc = python_nondynamic.C()
|
||||||
cc.d = 3
|
cc.d = 3
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@ except RuntimeError,e:
|
||||||
if e.args[0] != "I died.":
|
if e.args[0] != "I died.":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
try:
|
# This is expected fail with -builtin option
|
||||||
# Throwing builtin classes as exceptions not supported
|
# Throwing builtin classes as exceptions not supported
|
||||||
# t.hosed()
|
try:
|
||||||
|
t.hosed()
|
||||||
pass
|
pass
|
||||||
except threads_exception.Exc,e:
|
except threads_exception.Exc,e:
|
||||||
if e.code != 42:
|
if e.code != 42:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue