diff --git a/.travis.yml b/.travis.yml
index 56216838f..29c3129d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -222,11 +222,6 @@ matrix:
env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.7
sudo: required
dist: trusty
- - compiler: gcc
- os: linux
- env: SWIGLANG=python SWIG_FEATURES=-classic
- sudo: required
- dist: trusty
- compiler: gcc
os: linux
env: SWIGLANG=r
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index db9bf978d..4958d80ab 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -6313,9 +6313,7 @@ SWIG is able to support Python 3.x. The wrapper code generated by
SWIG can be compiled with both Python 2.x or 3.x. Further more, by
passing the -py3 command line option to SWIG, wrapper code
with some Python 3 specific features can be generated (see below
-subsections for details of these features). The -py3 option also
-disables some incompatible features for Python 3, such as
--classic.
+subsections for details of these features).
There is a list of known-to-be-broken features in Python 3:
diff --git a/Examples/python/exceptproxy/example.i b/Examples/python/exceptproxy/example.i
index f5f835149..4ad960845 100644
--- a/Examples/python/exceptproxy/example.i
+++ b/Examples/python/exceptproxy/example.i
@@ -59,15 +59,15 @@
*/
/*
- Now, the EmptyError doesn't appear in a throw declaration, and hence
- we need to 'mark' it as an exception class. In python, classes that
- are used as exception are 'special', and need to be wrapped as
- 'classic' ones.
-
- This is a python issue, and if you don't mark the class, you will
- see 'interesting' behaviours at the python side.
-
+ Python classes that are used as exceptions need to be subclasses of the
+ "Exception" class, and so SWIG needs to know which wrapped classes may be
+ used in this way. You can explicitly tell SWIG this by using
+ %exceptionclass. SWIG will implicitly set this feature for classes which
+ appear in a throw declaration, but it's not a problem to explicitly
+ mark such classes as well.
+ This is a Python requirement - if you fail to mark such classes with
+ %exceptionclass you may see 'interesting' behaviour on the Python side.
*/
%exceptionclass EmptyError;
%exceptionclass FullError;
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index 3c3c00c1a..5f6a7f57f 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -10,10 +10,6 @@ print " Finished importing pkg2.foo"
var2 = pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
-# Check for an old-style class if swig was run in -classic mode
-if classname == "":
- classname = str(var2.__class__)
-
if classname.find("pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg2.foo.Pkg2_Foo"
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index 38daad0a3..55f6826b9 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -9,10 +9,6 @@ print " Finished importing pkg1.pkg2.foo"
var2 = pkg1.pkg2.foo.Pkg2_Foo()
classname = str(type(var2))
-# Check for an old-style class if swig was run in -classic mode
-if classname == "":
- classname = str(var2.__class__)
-
if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1:
raise RuntimeError("failed type checking: " + classname)
print " Successfully created object pkg1.pkg2.foo.Pkg2_Foo"
diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py
index d89c7a880..1350c6d67 100644
--- a/Examples/test-suite/python/autodoc_runme.py
+++ b/Examples/test-suite/python/autodoc_runme.py
@@ -10,9 +10,6 @@ def check(got, expected, expected_builtin=None, skip=False):
expect = expected_builtin
comment_verifier.check(got, expect)
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
def is_fastproxy():
fastproxy = True
try:
@@ -21,11 +18,6 @@ def is_fastproxy():
fastproxy = False
return fastproxy
-if not is_new_style_class(A):
- # Missing static methods make this hard to test... skip if -classic is
- # used!
- sys.exit(0)
-
if is_fastproxy():
# Detect when -fastproxy is specified and skip test as it changes the function names making it
# hard to test... skip until the number of options are reduced in SWIG-3.1 and autodoc is improved
diff --git a/Examples/test-suite/python/cpp_static_runme.py b/Examples/test-suite/python/cpp_static_runme.py
index ef31f88af..e8c8cf615 100644
--- a/Examples/test-suite/python/cpp_static_runme.py
+++ b/Examples/test-suite/python/cpp_static_runme.py
@@ -2,17 +2,9 @@
from cpp_static import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-if is_new_style_class(StaticFunctionTest):
- StaticFunctionTest.static_func()
- StaticFunctionTest.static_func_2(1)
- StaticFunctionTest.static_func_3(1, 2)
-else:
- StaticFunctionTest().static_func()
- StaticFunctionTest().static_func_2(1)
- StaticFunctionTest().static_func_3(1, 2)
+StaticFunctionTest.static_func()
+StaticFunctionTest.static_func_2(1)
+StaticFunctionTest.static_func_3(1, 2)
if is_python_builtin():
if not StaticMemberTest.static_int == 99: raise RuntimeError("static_int not 99")
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 4d937d220..683314dfe 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -2,10 +2,6 @@
# the use of __main__ and the run function
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
def run(module_name):
default_args = __import__(module_name)
ec = default_args.EnumClass()
@@ -101,10 +97,7 @@ def run(module_name):
if error:
raise RuntimeError("Foo::meth ignore is not working")
- if is_new_style_class(default_args.Klass):
- Klass_inc = default_args.Klass.inc
- else:
- Klass_inc = default_args.Klass_inc
+ Klass_inc = default_args.Klass.inc
if Klass_inc(100, default_args.Klass(22)).val != 122:
raise RuntimeError("Klass::inc failed")
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index 031c476d8..333b75fe5 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -1,10 +1,6 @@
import director_abstract
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
class MyFoo(director_abstract.Foo):
def __init__(self):
@@ -44,20 +40,12 @@ me1 = MyExample1()
if director_abstract.Example1_get_color(me1, 1, 2, 3) != 1:
raise RuntimeError
-if is_new_style_class(MyExample2):
- MyExample2_static = MyExample2
-else:
- MyExample2_static = MyExample2(0, 0)
me2 = MyExample2(1, 2)
-if MyExample2_static.get_color(me2, 1, 2, 3) != 2:
+if MyExample2.get_color(me2, 1, 2, 3) != 2:
raise RuntimeError
-if is_new_style_class(MyExample3):
- MyExample3_static = MyExample3
-else:
- MyExample3_static = MyExample3()
me3 = MyExample3()
-if MyExample3_static.get_color(me3, 1, 2, 3) != 3:
+if MyExample3.get_color(me3, 1, 2, 3) != 3:
raise RuntimeError
error = 1
diff --git a/Examples/test-suite/python/global_namespace_runme.py b/Examples/test-suite/python/global_namespace_runme.py
index ac12fe2dc..a47f41047 100644
--- a/Examples/test-suite/python/global_namespace_runme.py
+++ b/Examples/test-suite/python/global_namespace_runme.py
@@ -1,9 +1,6 @@
from global_namespace import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
k1 = Klass1()
k2 = Klass2()
k3 = Klass3()
@@ -12,12 +9,8 @@ k5 = Klass5()
k6 = Klass6()
k7 = Klass7()
-if is_new_style_class(KlassMethods):
- KlassMethods_static = KlassMethods
-else:
- KlassMethods_static = KlassMethods()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1A()
k2 = getKlass2A()
@@ -27,8 +20,8 @@ k5 = getKlass5A()
k6 = getKlass6A()
k7 = getKlass7A()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
k1 = getKlass1B()
k2 = getKlass2B()
@@ -38,21 +31,11 @@ k5 = getKlass5B()
k6 = getKlass6B()
k7 = getKlass7B()
-KlassMethods_static.methodA(k1, k2, k3, k4, k5, k6, k7)
-KlassMethods_static.methodB(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodA(k1, k2, k3, k4, k5, k6, k7)
+KlassMethods.methodB(k1, k2, k3, k4, k5, k6, k7)
-if is_new_style_class(XYZMethods):
- XYZMethods_static = XYZMethods
-else:
- XYZMethods_static = XYZMethods()
-XYZMethods_static.methodA(
- XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
-XYZMethods_static.methodB(
- XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
+XYZMethods.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
+XYZMethods.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
-if is_new_style_class(TheEnumMethods):
- TheEnumMethods_static = TheEnumMethods
-else:
- TheEnumMethods_static = TheEnumMethods()
-TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)
-TheEnumMethods_static.methodA(theenum1, theenum2, theenum3)
+TheEnumMethods.methodA(theenum1, theenum2, theenum3)
+TheEnumMethods.methodA(theenum1, theenum2, theenum3)
diff --git a/Examples/test-suite/python/implicittest_runme.py b/Examples/test-suite/python/implicittest_runme.py
index 4646d08c0..f17788e97 100644
--- a/Examples/test-suite/python/implicittest_runme.py
+++ b/Examples/test-suite/python/implicittest_runme.py
@@ -6,9 +6,6 @@ def check(a, b):
raise RuntimeError(str(a) + " does not equal " + str(b))
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
#### Class ####
# No implicit conversion
@@ -45,17 +42,13 @@ check(2, A_int(1.0).get())
check(3, A_int(B()).get())
check(4, A_int("hello").get())
-if is_new_style_class(A_int):
- A_int_static = A_int
-else:
- A_int_static = A_int(0)
-check(1, A_int_static.sget(1))
-check(2, A_int_static.sget(1.0))
-check(3, A_int_static.sget(B()))
+check(1, A_int.sget(1))
+check(2, A_int.sget(1.0))
+check(3, A_int.sget(B()))
# explicit constructor:
try:
- check(4, A_int_static.sget("hello"))
+ check(4, A_int.sget("hello"))
raise RuntimeError
except TypeError:
pass
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
index 9b9c7d683..adf9ac4cf 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
@@ -1,10 +1,6 @@
from li_boost_shared_ptr_bits import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
-
def check(nd):
nd.i = 200
i = nd.i
@@ -35,7 +31,4 @@ if sum != 66:
raise "sum is wrong"
################################
-if is_new_style_class(HiddenDestructor):
- p = HiddenDestructor.create()
-else:
- p = HiddenDestructor_create()
+p = HiddenDestructor.create()
diff --git a/Examples/test-suite/python/namespace_class_runme.py b/Examples/test-suite/python/namespace_class_runme.py
index e0bd3ca09..aa5165562 100644
--- a/Examples/test-suite/python/namespace_class_runme.py
+++ b/Examples/test-suite/python/namespace_class_runme.py
@@ -1,9 +1,5 @@
from namespace_class import *
-
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
try:
p = Private1()
error = 1
@@ -22,10 +18,7 @@ except:
if (error):
raise RuntimeError, "Private2 is private"
-if is_new_style_class(EulerT3D):
- EulerT3D.toFrame(1, 1, 1)
-else:
- EulerT3D().toFrame(1, 1, 1)
+EulerT3D.toFrame(1, 1, 1)
b = BooT_i()
b = BooT_H()
@@ -40,7 +33,6 @@ f.moo(1)
f = FooT_H()
f.foo(Hi)
-if is_new_style_class(FooT_H):
- f_type = str(type(f))
- if f_type.find("'namespace_class.FooT_H'") == -1:
- raise RuntimeError("Incorrect type: " + f_type)
+f_type = str(type(f))
+if f_type.find("'namespace_class.FooT_H'") == -1:
+ raise RuntimeError("Incorrect type: " + f_type)
diff --git a/Examples/test-suite/python/overload_template_fast_runme.py b/Examples/test-suite/python/overload_template_fast_runme.py
index 95349a9b1..ca3cac9b5 100644
--- a/Examples/test-suite/python/overload_template_fast_runme.py
+++ b/Examples/test-suite/python/overload_template_fast_runme.py
@@ -1,9 +1,5 @@
from overload_template_fast import *
-
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
f = foo()
a = maximum(3, 4)
@@ -145,9 +141,6 @@ if (nsoverload() != 1050):
raise RuntimeError, ("nsoverload(const char *)")
-if is_new_style_class(A):
- A.foo(1)
-else:
- A_foo(1)
+A.foo(1)
b = B()
b.foo(1)
diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py
index ce5514dff..eddda53ff 100644
--- a/Examples/test-suite/python/python_append_runme.py
+++ b/Examples/test-suite/python/python_append_runme.py
@@ -1,19 +1,13 @@
from python_append import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
# test not relevant for -builtin
if is_python_builtin():
exit(0)
t = Test()
t.funk()
-if is_new_style_class(Test):
- t.static_func()
-else:
- Test_static_func()
+t.static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError("grabpath failed")
diff --git a/Examples/test-suite/python/python_docstring_runme.py b/Examples/test-suite/python/python_docstring_runme.py
index 0284ea0de..a601ecb54 100644
--- a/Examples/test-suite/python/python_docstring_runme.py
+++ b/Examples/test-suite/python/python_docstring_runme.py
@@ -9,7 +9,7 @@ def check(got, expected):
raise RuntimeError("\n" + "Expected: " + str(expected_list) + "\n" + "Got : " + str(got_list))
# When getting docstrings, use inspect.getdoc(x) instead of x.__doc__ otherwise the different options
-# such as -O, -builtin, -classic produce different initial indentation.
+# such as -O and -builtin may produce different initial indentation.
check(inspect.getdoc(DocStrings.docstring1),
" line 1\n"
diff --git a/Examples/test-suite/python/python_pickle_runme.py b/Examples/test-suite/python/python_pickle_runme.py
index cf2847919..27c67ae10 100644
--- a/Examples/test-suite/python/python_pickle_runme.py
+++ b/Examples/test-suite/python/python_pickle_runme.py
@@ -3,17 +3,11 @@ import python_pickle
import pickle
import sys
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
def check(p):
msg = p.msg
if msg != "hi there":
raise RuntimeError("Bad, got: " + msg)
-if not is_new_style_class(python_pickle.PickleMe):
- sys.exit(0)
-
python_pickle.cvar.debug = False
p = python_pickle.PickleMe("hi there")
diff --git a/Examples/test-suite/python/python_richcompare_runme.py b/Examples/test-suite/python/python_richcompare_runme.py
index 247660301..724d1d73c 100644
--- a/Examples/test-suite/python/python_richcompare_runme.py
+++ b/Examples/test-suite/python/python_richcompare_runme.py
@@ -6,9 +6,6 @@ def check_unorderable_types(exception):
# raise RuntimeError("A TypeError 'unorderable types' exception was expected"), None, sys.exc_info()[2]
pass # Exception message seems to vary from one version of Python to another
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
base1 = python_richcompare.BaseClass(1)
base2 = python_richcompare.BaseClass(2)
base3 = python_richcompare.BaseClass(3)
@@ -103,39 +100,37 @@ if not (a2 <= b2):
# Check inequalities to other objects
#-------------------------------------------------------------------------------
-if is_new_style_class(python_richcompare.BaseClass):
- # Skip testing -classic option
- if sys.version_info[0:2] < (3, 0):
- if (base1 < 42):
- raise RuntimeError("Comparing class to incompatible type, < returned True")
- if (base1 <= 42):
- raise RuntimeError("Comparing class to incompatible type, <= returned True")
- if not (base1 > 42):
- raise RuntimeError("Comparing class to incompatible type, > returned False")
- if not (base1 >= 42):
- raise RuntimeError("Comparing class to incompatible type, >= returned False")
- else:
- # Python 3 throws: TypeError: unorderable types
- try:
- res = base1 < 42
- raise RuntimeError("Failed to throw")
- except TypeError,e:
- check_unorderable_types(e)
- try:
- res = base1 <= 42
- raise RuntimeError("Failed to throw")
- except TypeError,e:
- check_unorderable_types(e)
- try:
- res = base1 > 42
- raise RuntimeError("Failed to throw")
- except TypeError,e:
- check_unorderable_types(e)
- try:
- res = base1 >= 42
- raise RuntimeError("Failed to throw")
- except TypeError,e:
- check_unorderable_types(e)
+if sys.version_info[0:2] < (3, 0):
+ if (base1 < 42):
+ raise RuntimeError("Comparing class to incompatible type, < returned True")
+ if (base1 <= 42):
+ raise RuntimeError("Comparing class to incompatible type, <= returned True")
+ if not (base1 > 42):
+ raise RuntimeError("Comparing class to incompatible type, > returned False")
+ if not (base1 >= 42):
+ raise RuntimeError("Comparing class to incompatible type, >= returned False")
+else:
+ # Python 3 throws: TypeError: unorderable types
+ try:
+ res = base1 < 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 <= 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 > 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
+ try:
+ res = base1 >= 42
+ raise RuntimeError("Failed to throw")
+ except TypeError,e:
+ check_unorderable_types(e)
# Check inequalities used for ordering
#-------------------------------------------------------------------------
diff --git a/Examples/test-suite/python/smart_pointer_member_runme.py b/Examples/test-suite/python/smart_pointer_member_runme.py
index ce91da2bd..d2ed87e79 100644
--- a/Examples/test-suite/python/smart_pointer_member_runme.py
+++ b/Examples/test-suite/python/smart_pointer_member_runme.py
@@ -1,9 +1,6 @@
from smart_pointer_member import *
-def is_new_style_class(cls):
- return hasattr(cls, "__class__")
-
f = Foo()
f.y = 1
@@ -24,6 +21,5 @@ if b.x != f.x:
if b.z != f.z:
raise RuntimeError
-if is_new_style_class(Bar): # feature not supported in old style classes
- if Foo.z == Bar.z:
- raise RuntimeError
+if Foo.z == Bar.z:
+ raise RuntimeError
diff --git a/Examples/test-suite/python_nondynamic.i b/Examples/test-suite/python_nondynamic.i
index 14c8d6b0e..b08cec9e6 100644
--- a/Examples/test-suite/python_nondynamic.i
+++ b/Examples/test-suite/python_nondynamic.i
@@ -29,8 +29,6 @@
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
- and works for modern (-modern) and plain python.
-
*/
diff --git a/Lib/python/pyuserdir.swg b/Lib/python/pyuserdir.swg
index af9c86d3c..311076079 100644
--- a/Lib/python/pyuserdir.swg
+++ b/Lib/python/pyuserdir.swg
@@ -41,9 +41,6 @@ The implementation is based on this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
-and works for modern (-modern) and plain python. We do not use __slots__,
-so, it works with old python versions.
-
*/
#define %pythonnondynamic %feature("python:nondynamic", "1")
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index c2952d630..e5b58be75 100755
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -65,8 +65,6 @@ static String *methods;
static String *class_name;
static String *shadow_indent = 0;
static int in_class = 0;
-static int classic = 0;
-static int modern = 0;
static int new_repr = 1;
static int no_header_file = 0;
static int max_bases = 0;
@@ -91,13 +89,11 @@ static int nobuildnone = 0;
static int safecstrings = 0;
static int dirvtable = 0;
static int doxygen = 0;
-static int proxydel = 1;
static int fastunpack = 0;
static int fastproxy = 0;
static int fastquery = 0;
static int fastinit = 0;
static int olddefs = 0;
-static int modernargs = 0;
static int aliasobj0 = 0;
static int castmode = 0;
static int extranative = 0;
@@ -123,7 +119,6 @@ Python Options (available with -python)\n\
-buildnone - Use Py_BuildValue(" ") to obtain Py_None (default in Windows)\n\
-builtin - Create new python built-in types, rather than proxy classes, for better performance\n\
-castmode - Enable the casting mode, which allows implicit cast between types in python\n\
- -classic - Use classic classes only\n\
-classptr - Generate shadow 'ClassPtr' as in older swig versions\n\
-cppcast - Enable C++ casting operators (default) \n\
-dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\
@@ -137,9 +132,7 @@ Python Options (available with -python)\n\
-fastquery - Use fast query mechanism for types \n\
-globals - Set used to access C global variable [default: 'cvar']\n\
-interface - Set the lib name to \n\
- -keyword - Use keyword arguments\n\
- -modern - Use modern python features only, without compatibility code\n\
- -modernargs - Use \"modern\" args mechanism to pack/unpack the function arguments\n";
+ -keyword - Use keyword arguments\n";
static const char *usage2 = "\
-newrepr - Use more informative version of __repr__ in proxy classes (default) \n\
-newvwm - New value wrapper mode, use only when everything else fails \n\
@@ -154,14 +147,11 @@ static const char *usage2 = "\
-nofastunpack - Use traditional UnpackTuple method to parse the argument functions (default) \n\
-nofastproxy - Use traditional proxy mechanism for member methods (default) \n\
-nofastquery - Use traditional query mechanism for types (default) \n\
- -noh - Don't generate the output header file\n\
- -nomodern - Don't use modern python features which are not backwards compatible \n\
- -nomodernargs - Use classic ParseTuple/CallFunction methods to pack/unpack the function arguments (default) \n";
+ -noh - Don't generate the output header file\n";
static const char *usage3 = "\
-noolddefs - Don't emit the old method definitions even when using fastproxy (default) \n\
-nooutputtuple - Use a PyList for appending output values (default) \n\
-noproxy - Don't generate proxy classes \n\
- -noproxydel - Don't generate the redundant __del__ method \n\
-noproxyimport - Don't insert proxy import statements derived from the %import directive \n\
-nortti - Disable the use of the native C++ RTTI with directors\n\
-nosafecstrings - Avoid extra strings copies when possible (default)\n\
@@ -169,14 +159,13 @@ static const char *usage3 = "\
-olddefs - Keep the old method definitions even when using fastproxy\n\
-oldrepr - Use shorter and old version of __repr__ in proxy classes\n\
-outputtuple - Use a PyTuple for outputs instead of a PyList (use carefully with legacy interfaces) \n\
- -proxydel - Generate a __del__ method even though it is now redundant (default) \n\
-py3 - Generate code with Python 3 specific features and syntax\n\
-relativeimport - Use relative python imports \n\
-safecstrings - Use safer (but slower) C string mapping, generating copies from Python -> C/C++\n\
-threads - Add thread support for all the interface\n\
-O - Enable the following optimization options: \n\
- -modern -fastdispatch -nosafecstrings -fvirtual -noproxydel \n\
- -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone \n\
+ -fastdispatch -nosafecstrings -fvirtual\n\
+ -fastproxy -fastinit -fastunpack -fastquery -nobuildnone\n\
\n";
static String *getSlot(Node *n = NULL, const char *key = NULL, String *default_slot = NULL) {
@@ -392,11 +381,6 @@ public:
use_kw = 1;
SWIG_cparse_set_compact_default_args(1);
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-classic") == 0) {
- classic = 1;
- modernargs = 0;
- modern = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-cppcast") == 0) {
cppcast = 1;
Swig_mark_arg(i);
@@ -491,33 +475,11 @@ public:
} else if (strcmp(argv[i], "-noextranative") == 0) {
extranative = 0;
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-modernargs") == 0) {
- modernargs = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nomodernargs") == 0) {
- modernargs = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-aliasobj0") == 0) {
aliasobj0 = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-noaliasobj0") == 0) {
aliasobj0 = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-proxydel") == 0) {
- proxydel = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-noproxydel") == 0) {
- proxydel = 0;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-modern") == 0) {
- classic = 0;
- modern = 1;
- modernargs = 1;
- Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nomodern") == 0) {
- modern = 0;
- modernargs = 0;
- Swig_mark_arg(i);
} else if (strcmp(argv[i], "-noh") == 0) {
no_header_file = 1;
Swig_mark_arg(i);
@@ -527,18 +489,14 @@ public:
no_header_file = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-O") == 0) {
- classic = 0;
- modern = 1;
safecstrings = 0;
buildnone = 0;
nobuildnone = 1;
classptr = 0;
- proxydel = 0;
fastunpack = 1;
fastproxy = 1;
fastinit = 1;
fastquery = 1;
- modernargs = 1;
Wrapper_fast_dispatch_mode_set(1);
Wrapper_virtual_elimination_mode_set(1);
Swig_mark_arg(i);
@@ -557,16 +515,21 @@ public:
} else if (strcmp(argv[i], "-relativeimport") == 0) {
relativeimport = 1;
Swig_mark_arg(i);
+ } else if (strcmp(argv[i], "-modern") == 0 ||
+ strcmp(argv[i], "-modernargs") == 0 ||
+ strcmp(argv[i], "-noproxydel") == 0) {
+ Printf(stderr, "Option %s is now always on.\n", argv[i]);
+ } else if (strcmp(argv[i], "-classic") == 0 ||
+ strcmp(argv[i], "-nomodern") == 0 ||
+ strcmp(argv[i], "-nomodernargs") == 0 ||
+ strcmp(argv[i], "-proxydel") == 0) {
+ Printf(stderr, "*** %s is no longer supported.\n", argv[i]);
+ SWIG_exit(EXIT_FAILURE);
}
}
}
- if (py3) {
- /* force disable features that not compatible with Python 3.x */
- classic = 0;
- }
-
if (cppcast) {
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
}
@@ -745,10 +708,6 @@ public:
Printf(f_runtime, "#define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS\n");
}
- if (classic) {
- Printf(f_runtime, "#define SWIG_PYTHON_CLASSIC\n");
- }
-
if (builtin) {
Printf(f_runtime, "#define SWIGPYTHON_BUILTIN\n");
}
@@ -893,8 +852,6 @@ public:
Printf(f_shadow, "_swig_new_instance_method = %s.SWIG_PyInstanceMethod_New\n", module);
}
- /* if (!modern) */
- /* always needed, a class can be forced to be no-modern, such as an exception */
{
// Python-2.2 object hack
Printv(f_shadow,
@@ -911,15 +868,7 @@ public:
tab4, "if not static:\n",
#endif
NIL);
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, tab4, "object.__setattr__(self, name, value)\n", NIL);
- if (!modern)
- Printv(f_shadow, tab4, tab4, "else:\n", tab4, NIL);
- }
- if (classic || !modern)
- Printv(f_shadow, tab4, tab4, "self.__dict__[name] = value\n", NIL);
+ Printv(f_shadow, tab4, tab4, "object.__setattr__(self, name, value)\n", NIL);
Printv(f_shadow,
tab4, "else:\n",
tab4, tab4, "raise AttributeError(\"You cannot add attributes to %s\" % self)\n\n",
@@ -936,58 +885,49 @@ public:
"\n", "def _swig_repr(self):\n",
tab4, "try:\n", tab8, "strthis = \"proxy of \" + self.this.__repr__()\n",
tab4, "except __builtin__.Exception:\n", tab8, "strthis = \"\"\n", tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL);
-
- if (!classic && !modern) {
- Printv(f_shadow,
- "try:\n",
- tab4, "_object = object\n", tab4, "_newclass = 1\n",
- "except __builtin__.Exception:\n",
- tab4, "class _object:\n", tab8, "pass\n", tab4, "_newclass = 0\n\n", NIL);
- }
}
- if (modern) {
- Printv(f_shadow, "\n",
- "def _swig_setattr_nondynamic_instance_variable(set):\n",
- tab4, "def set_instance_attr(self, name, value):\n",
+
+ Printv(f_shadow, "\n",
+ "def _swig_setattr_nondynamic_instance_variable(set):\n",
+ tab4, "def set_instance_attr(self, name, value):\n",
#ifdef USE_THISOWN
- tab4, tab4, "if name in (\"this\", \"thisown\"):\n",
- tab4, tab4, tab4, "set(self, name, value)\n",
+ tab4, tab4, "if name in (\"this\", \"thisown\"):\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
#else
- tab4, tab4, "if name == \"thisown\":\n",
- tab4, tab4, tab4, "self.this.own(value)\n",
- tab4, tab4, "elif name == \"this\":\n",
- tab4, tab4, tab4, "set(self, name, value)\n",
+ tab4, tab4, "if name == \"thisown\":\n",
+ tab4, tab4, tab4, "self.this.own(value)\n",
+ tab4, tab4, "elif name == \"this\":\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
#endif
- tab4, tab4, "elif hasattr(self, name) and isinstance(getattr(type(self), name), property):\n",
- tab4, tab4, tab4, "set(self, name, value)\n",
- tab4, tab4, "else:\n",
- tab4, tab4, tab4, "raise AttributeError(\"You cannot add instance attributes to %s\" % self)\n",
- tab4, "return set_instance_attr\n\n", NIL);
+ tab4, tab4, "elif hasattr(self, name) and isinstance(getattr(type(self), name), property):\n",
+ tab4, tab4, tab4, "set(self, name, value)\n",
+ tab4, tab4, "else:\n",
+ tab4, tab4, tab4, "raise AttributeError(\"You cannot add instance attributes to %s\" % self)\n",
+ tab4, "return set_instance_attr\n\n", NIL);
- Printv(f_shadow, "\n",
- "def _swig_setattr_nondynamic_class_variable(set):\n",
- tab4, "def set_class_attr(cls, name, value):\n",
- tab4, tab4, "if hasattr(cls, name) and not isinstance(getattr(cls, name), property):\n",
- tab4, tab4, tab4, "set(cls, name, value)\n",
- tab4, tab4, "else:\n",
- tab4, tab4, tab4, "raise AttributeError(\"You cannot add class attributes to %s\" % cls)\n",
- tab4, "return set_class_attr\n\n", NIL);
+ Printv(f_shadow, "\n",
+ "def _swig_setattr_nondynamic_class_variable(set):\n",
+ tab4, "def set_class_attr(cls, name, value):\n",
+ tab4, tab4, "if hasattr(cls, name) and not isinstance(getattr(cls, name), property):\n",
+ tab4, tab4, tab4, "set(cls, name, value)\n",
+ tab4, tab4, "else:\n",
+ tab4, tab4, tab4, "raise AttributeError(\"You cannot add class attributes to %s\" % cls)\n",
+ tab4, "return set_class_attr\n\n", NIL);
- Printv(f_shadow, "\n",
- "def _swig_add_metaclass(metaclass):\n",
- tab4, "\"\"\"Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass\"\"\"\n",
- tab4, "def wrapper(cls):\n",
- tab4, tab4, "return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())\n",
- tab4, "return wrapper\n\n", NIL);
+ Printv(f_shadow, "\n",
+ "def _swig_add_metaclass(metaclass):\n",
+ tab4, "\"\"\"Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass\"\"\"\n",
+ tab4, "def wrapper(cls):\n",
+ tab4, tab4, "return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())\n",
+ tab4, "return wrapper\n\n", NIL);
- Printv(f_shadow, "\n",
- "class _SwigNonDynamicMeta(type):\n",
- tab4, "\"\"\"Meta class to enforce nondynamic attributes (no new attributes) for a class\"\"\"\n",
- tab4, "__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)\n",
- "\n", NIL);
+ Printv(f_shadow, "\n",
+ "class _SwigNonDynamicMeta(type):\n",
+ tab4, "\"\"\"Meta class to enforce nondynamic attributes (no new attributes) for a class\"\"\"\n",
+ tab4, "__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)\n",
+ "\n", NIL);
- Printv(f_shadow, "\n", NIL);
- }
+ Printv(f_shadow, "\n", NIL);
if (directorsEnabled()) {
Printv(f_shadow, "import weakref\n\n", NIL);
@@ -1057,9 +997,6 @@ public:
if (shadow) {
Swig_banner_target_lang(f_shadow_py, "#");
- if (!modern && !classic) {
- Printv(f_shadow, "# This file is compatible with both classic and new-style classes.\n", NIL);
- }
if (Len(f_shadow_begin) > 0)
Printv(f_shadow_py, "\n", f_shadow_begin, "\n", NIL);
if (Len(f_shadow_after_begin) > 0)
@@ -2860,7 +2797,7 @@ public:
over_varargs = true;
}
- int funpack = modernargs && fastunpack && !varargs && !over_varargs && !allow_kwargs;
+ int funpack = fastunpack && !varargs && !over_varargs && !allow_kwargs;
int noargs = funpack && (tuple_required == 0 && tuple_arguments == 0);
int onearg = funpack && (tuple_required == 1 && tuple_arguments == 1);
@@ -3007,7 +2944,7 @@ public:
if (builtin && !funpack && in_class && tuple_arguments == 0) {
Printf(parse_args, " if (args && PyTuple_Check(args) && PyTuple_GET_SIZE(args) > 0) SWIG_exception_fail(SWIG_TypeError, \"%s takes no arguments\");\n", iname);
- } else if (use_parse || allow_kwargs || !modernargs) {
+ } else if (use_parse || allow_kwargs) {
Printf(parse_args, ":%s\"", iname);
Printv(parse_args, arglist, ")) SWIG_fail;\n", NIL);
funpack = 0;
@@ -3677,14 +3614,10 @@ public:
Printf(f_wrappers, "SWIGINTERN PyObject *%s_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", iname);
Printf(f_wrappers, tab2 "PyObject *module;\n", tm);
Printf(f_wrappers, tab2 "PyObject *d;\n");
- if (modernargs) {
- if (fastunpack) {
- Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
- } else {
- Printf(f_wrappers, tab2 "if (!PyArg_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
- }
+ if (fastunpack) {
+ Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
} else {
- Printf(f_wrappers, tab2 "if (!PyArg_ParseTuple(args,(char *)\"O:swigconstant\", &module)) return NULL;\n");
+ Printf(f_wrappers, tab2 "if (!PyArg_UnpackTuple(args,(char *)\"swigconstant\", 1, 1,&module)) return NULL;\n");
}
Printf(f_wrappers, tab2 "d = PyModule_GetDict(module);\n");
Printf(f_wrappers, tab2 "if (!d) return NULL;\n");
@@ -4020,7 +3953,7 @@ public:
String *mname = SwigType_manglestr(rname);
String *pmname = SwigType_manglestr(pname);
String *templ = NewStringf("SwigPyBuiltin_%s", mname);
- int funpack = modernargs && fastunpack;
+ int funpack = fastunpack;
static String *tp_new = NewString("PyType_GenericNew");
Printv(f_init, " SwigPyBuiltin_SetMetaType(builtin_pytype, metatype);\n", NIL);
@@ -4433,8 +4366,6 @@ public:
}
virtual int classHandler(Node *n) {
- int oldclassic = classic;
- int oldmodern = modern;
File *f_shadow_file = f_shadow;
Node *base_node = NULL;
@@ -4444,19 +4375,6 @@ public:
have_constructor = 0;
have_repr = 0;
- if (GetFlag(n, "feature:classic")) {
- classic = 1;
- modern = 0;
- }
- if (GetFlag(n, "feature:modern")) {
- classic = 0;
- modern = 1;
- }
- if (GetFlag(n, "feature:exceptionclass")) {
- classic = 1;
- modern = 0;
- }
-
class_name = Getattr(n, "sym:name");
real_classname = Getattr(n, "name");
@@ -4532,7 +4450,7 @@ public:
Delete(rname);
}
} else {
- if (modern && !py3) {
+ if (!py3) {
if (GetFlag(n, "feature:python:nondynamic"))
Printv(f_shadow, "@_swig_add_metaclass(_SwigNonDynamicMeta)\n", NIL);
}
@@ -4541,13 +4459,12 @@ public:
if (Len(base_class)) {
Printf(f_shadow, "(%s)", base_class);
} else {
- if (!classic) {
- Printf(f_shadow, modern ? "(object" : "(_object");
- Printf(f_shadow, modern && py3 && GetFlag(n, "feature:python:nondynamic") ? ", metaclass=_SwigNonDynamicMeta" : "", ")");
- Printf(f_shadow, ")");
- }
if (GetFlag(n, "feature:exceptionclass")) {
Printf(f_shadow, "(Exception)");
+ } else {
+ Printf(f_shadow, "(object");
+ Printf(f_shadow, py3 && GetFlag(n, "feature:python:nondynamic") ? ", metaclass=_SwigNonDynamicMeta" : "", ")");
+ Printf(f_shadow, ")");
}
}
@@ -4560,30 +4477,10 @@ public:
Printv(f_shadow, tab4, str, "\n\n", NIL);
}
- if (!modern) {
- Printv(f_shadow, tab4, "__swig_setmethods__ = {}\n", NIL);
- if (Len(base_class)) {
- Printv(f_shadow, tab4, "for _s in [", base_class, "]:\n", tab8, "__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))\n", NIL);
- }
-
- if (!GetFlag(n, "feature:python:nondynamic")) {
- Printv(f_shadow, tab4, "__setattr__ = lambda self, name, value: _swig_setattr(self, ", class_name, ", name, value)\n", NIL);
- } else {
- Printv(f_shadow, tab4, "__setattr__ = lambda self, name, value: _swig_setattr_nondynamic(self, ", class_name, ", name, value)\n", NIL);
- }
-
- Printv(f_shadow, tab4, "__swig_getmethods__ = {}\n", NIL);
- if (Len(base_class)) {
- Printv(f_shadow, tab4, "for _s in [", base_class, "]:\n", tab8, "__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))\n", NIL);
- }
-
- Printv(f_shadow, tab4, "__getattr__ = lambda self, name: _swig_getattr(self, ", class_name, ", name)\n", NIL);
- } else {
- Printv(f_shadow, tab4, "thisown = property(lambda x: x.this.own(), ", "lambda x, v: x.this.own(v), doc='The membership flag')\n", NIL);
- /* Add static attribute */
- if (GetFlag(n, "feature:python:nondynamic")) {
- Printv(f_shadow_file, tab4, "__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__)\n", NIL);
- }
+ Printv(f_shadow, tab4, "thisown = property(lambda x: x.this.own(), ", "lambda x, v: x.this.own(v), doc='The membership flag')\n", NIL);
+ /* Add static attribute */
+ if (GetFlag(n, "feature:python:nondynamic")) {
+ Printv(f_shadow_file, tab4, "__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__)\n", NIL);
}
}
}
@@ -4634,14 +4531,10 @@ public:
} else {
Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL);
Printv(f_wrappers, " PyObject *obj;\n", NIL);
- if (modernargs) {
- if (fastunpack) {
- Printv(f_wrappers, " if (!SWIG_Python_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
- } else {
- Printv(f_wrappers, " if (!PyArg_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
- }
+ if (fastunpack) {
+ Printv(f_wrappers, " if (!SWIG_Python_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
} else {
- Printv(f_wrappers, " if (!PyArg_ParseTuple(args,(char *)\"O:swigregister\", &obj)) return NULL;\n", NIL);
+ Printv(f_wrappers, " if (!PyArg_UnpackTuple(args,(char *)\"swigregister\", 1, 1,&obj)) return NULL;\n", NIL);
}
Printv(f_wrappers,
@@ -4691,15 +4584,10 @@ public:
/* Now the Ptr class */
if (classptr) {
Printv(f_shadow_file, "\nclass ", class_name, "Ptr(", class_name, "):\n", tab4, "def __init__(self, this):\n", NIL);
- if (!modern) {
- Printv(f_shadow_file,
- tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
- tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
- } else {
- Printv(f_shadow_file,
- tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
- tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
- }
+ Printv(f_shadow_file,
+ tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
+ tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
+
}
Printf(f_shadow_file, "\n");
@@ -4718,9 +4606,6 @@ public:
Clear(builtin_methods);
}
- classic = oldclassic;
- modern = oldmodern;
-
/* Restore shadow file back to original version */
Delete(f_shadow);
f_shadow = f_shadow_file;
@@ -4867,7 +4752,7 @@ public:
String *fullname = Swig_name_member(NSPACE_TODO, class_name, symname);
String *wname = Swig_name_wrapper(fullname);
Setattr(class_members, symname, n);
- int funpack = modernargs && fastunpack && !Getattr(n, "sym:overloaded");
+ int funpack = fastunpack && !Getattr(n, "sym:overloaded");
String *pyflags = NewString("METH_STATIC|");
int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2;
if (funpack && argcount == 0)
@@ -4913,17 +4798,8 @@ public:
}
Printv(f_shadow, tab4, symname, " = staticmethod(", symname, ")\n", NIL);
} else {
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = staticmethod(", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname),
- ")\n", NIL);
- }
- if (classic || !modern) {
- if (!classic)
- Printv(f_shadow, tab4, "else:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = ", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname), "\n", NIL);
- }
+ Printv(f_shadow, tab4, symname, " = staticmethod(", module, ".", Swig_name_member(NSPACE_TODO, class_name, symname),
+ ")\n", NIL);
}
}
return SWIG_OK;
@@ -5104,9 +4980,6 @@ public:
} else {
Printv(f_shadow, tab4, "__swig_destroy__ = ", module, ".", Swig_name_destroy(NSPACE_TODO, symname), "\n", NIL);
if (!have_pythonprepend(n) && !have_pythonappend(n)) {
- if (proxydel) {
- Printv(f_shadow, tab4, "def __del__(self):\n", tab8, "return None\n", NIL);
- }
return SWIG_OK;
}
Printv(f_shadow, tab4, "def __del__(self):\n", NIL);
@@ -5147,20 +5020,10 @@ public:
String *setname = Swig_name_set(NSPACE_TODO, mname);
String *getname = Swig_name_get(NSPACE_TODO, mname);
int assignable = is_assignable(n);
- if (!modern) {
- if (assignable) {
- Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", setname, "\n", NIL);
- }
- Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", getname, "\n", NIL);
- }
- if (!classic) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
- Printv(f_shadow, tab4, symname, " = property(", module, ".", getname, NIL);
- if (assignable)
- Printv(f_shadow, ", ", module, ".", setname, NIL);
- Printv(f_shadow, ")\n", NIL);
- }
+ Printv(f_shadow, tab4, symname, " = property(", module, ".", getname, NIL);
+ if (assignable)
+ Printv(f_shadow, ", ", module, ".", setname, NIL);
+ Printv(f_shadow, ")\n", NIL);
Delete(mname);
Delete(setname);
Delete(getname);
@@ -5206,7 +5069,7 @@ public:
DelWrapper(f);
int assignable = is_assignable(n);
if (assignable) {
- int funpack = modernargs && fastunpack;
+ int funpack = fastunpack;
Wrapper *f = NewWrapper();
Printv(f->def, "SWIGINTERN PyObject *", wrapsetname, "(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {", NIL);
Wrapper_add_local(f, "res", "int res");
@@ -5221,15 +5084,7 @@ public:
add_method(setname, wrapsetname, 0, 0, funpack, 1, 1);
DelWrapper(f);
}
- if (!modern && !builtin) {
- if (assignable) {
- Printv(f_shadow, tab4, "__swig_setmethods__[\"", symname, "\"] = ", module, ".", setname, "\n", NIL);
- }
- Printv(f_shadow, tab4, "__swig_getmethods__[\"", symname, "\"] = ", module, ".", getname, "\n", NIL);
- }
- if (!classic && !builtin) {
- if (!modern)
- Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
+ if (!builtin) {
Printv(f_shadow, tab4, symname, " = property(", module, ".", getname, NIL);
if (assignable)
Printv(f_shadow, ", ", module, ".", setname, NIL);
@@ -5680,34 +5535,26 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
Append(w->code, "PyObject *method = swig_get_method(swig_method_index, swig_method_name);\n");
if (Len(parse_args) > 0) {
- if (use_parse || !modernargs) {
+ if (use_parse) {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", Swig_cresult_name(), parse_args, arglist);
} else {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunctionObjArgs(method %s, NULL);\n", Swig_cresult_name(), arglist);
}
} else {
- if (modernargs) {
- Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_Call(method, (PyObject *) args, NULL);\n", Swig_cresult_name());
- } else {
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, NULL, NULL);\n", Swig_cresult_name());
- }
+ Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
+ Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_Call(method, (PyObject *) args, NULL);\n", Swig_cresult_name());
}
Append(w->code, "#else\n");
if (Len(parse_args) > 0) {
- if (use_parse || !modernargs) {
+ if (use_parse) {
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n", Swig_cresult_name(), pyname, parse_args, arglist);
} else {
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", Swig_cresult_name(), arglist);
}
} else {
- if (!modernargs) {
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", Swig_cresult_name(), pyname);
- } else {
- Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
- Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n", Swig_cresult_name());
- }
+ Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
+ Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n", Swig_cresult_name());
}
Append(w->code, "#endif\n");