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:
parent
dcbccc6f6f
commit
728b8955bd
20 changed files with 96 additions and 241 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue