Drop support for Python classic classes

There were only needed to support Python < 2.2, and we now require at
least Python 2.6.

 Conflicts:
	.travis.yml
	Examples/test-suite/python/autodoc_runme.py
	Source/Modules/python.cxx

This is a cherry-pick and merge from patch in #1261
This commit is contained in:
Olly Betts 2018-05-19 11:47:23 +12:00 committed by William S Fulton
commit 728b8955bd
20 changed files with 96 additions and 241 deletions

View file

@ -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