fixes for python 2.1

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-23 09:08:49 +00:00
commit 31b6e161eb
9 changed files with 27 additions and 12 deletions

View file

@ -4,7 +4,7 @@ from callback import *
if foo(2) != 2:
raise RuntimeError
if A.bar(2) != 4:
if A_bar(2) != 4:
raise RuntimeError
if foobar(3, _callback.foo) != foo(3):
@ -13,7 +13,7 @@ if foobar(3, _callback.foo) != foo(3):
if foobar(3, foo) != foo(3):
raise RuntimeError
if foobar(3, A.bar) != A.bar(3):
if foobar(3, A_bar) != A_bar(3):
raise RuntimeError
if foobar(3, foof) != foof(3):

View file

@ -1,7 +1,7 @@
import default_args
if default_args.Statics.staticMethod() != 60:
if default_args.Statics_staticMethod() != 60:
raise RuntimeError
if default_args.cfunc1(1) != 2:

View file

@ -29,7 +29,7 @@ class MyExample3(director_abstract.Example3_i):
return b
me1 = MyExample1()
if MyExample1.get_color(me1, 1,2,3) != 1:
if MyExample1_get_color(me1, 1,2,3) != 1:
raise RuntimeError
me2 = MyExample2(1,2)

View file

@ -53,7 +53,7 @@ class C(FooBar_int):
pass
cc = C()
c = C.get_self(cc)
c = FooBar_int_get_self(cc)
c.advance()
if c.get_name() != "FooBar::get_name hello":

View file

@ -14,13 +14,13 @@ f = Foo(b=2,a=1)
if f.foo(b=1,a=2) != 3:
raise RuntimeError
if Foo.statfoo(b=2) != 3:
if Foo_statfoo(b=2) != 3:
raise RuntimeError
if f.efoo(b=2) != 3:
raise RuntimeError
if Foo.sfoo(b=2) != 3:
if Foo_sfoo(b=2) != 3:
raise RuntimeError
@ -30,13 +30,13 @@ b = BarInt(b=2,a=1)
if b.bar(b=1,a=2) != 3:
raise RuntimeError
if BarInt.statbar(b=2) != 3:
if BarInt_statbar(b=2) != 3:
raise RuntimeError
if b.ebar(b=2) != 3:
raise RuntimeError
if BarInt.sbar(b=2) != 3:
if BarInt_sbar(b=2) != 3:
raise RuntimeError

View file

@ -5,7 +5,7 @@ r = circle.radius()
if (r != 1.5):
raise RuntimeError
point = Geometry.create(Geometry.POINT)
point = Geometry_create(Geometry.POINT)
w = point.width()
if (w != 1.0):
raise RuntimeError

View file

@ -140,6 +140,6 @@ if (nsoverload() != 1050):
raise RuntimeError, ("nsoverload(const char *)")
A.foo(1)
A_foo(1)
b = B()
b.foo(1)

View file

@ -1,3 +1,3 @@
from template_static import *
Foo.bar_double(1)
Foo_bar_double(1)

View file

@ -1134,6 +1134,14 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
Py_DECREF(dict);
}
return inst;
#else
#if (PY_VERSION_HEX >= 0x02010000)
PyObject *inst;
PyObject *dict = PyDict_New();
PyDict_SetItem(dict, SWIG_This(), swig_this);
inst = PyInstance_NewRaw(data->newargs, dict);
Py_DECREF(dict);
return (PyObject *) inst;
#else
PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
if (inst == NULL) {
@ -1146,9 +1154,16 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
Py_DECREF(inst);
return NULL;
}
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
inst->in_weakreflist = NULL;
#endif
#ifdef Py_TPFLAGS_GC
PyObject_GC_Init(inst);
#endif
PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
return (PyObject *) inst;
#endif
#endif
}
/* Create a new pointer object */