Merge branch 'ahnolds-classic_python'

* ahnolds-classic_python:
  Updating changelog and marking -classic as passing CI
  Support checking names of old-style classic classes
  Don't claim to new-style support in classic mode
  Clean up setting _object
  Removing __swig_getmethods__ for static methods
  Support python(pre|ap)pend on static methods in classic mode
  Add support for static methods in classic mode
  When possible, use PyInt rather than PyLong
This commit is contained in:
William S Fulton 2016-02-06 08:01:08 +00:00
commit bb01ed3286
8 changed files with 53 additions and 34 deletions

View file

@ -8,6 +8,12 @@ import pkg2.foo
print " Finished importing pkg2.foo"
var2 = pkg2.foo.Pkg2_Foo()
if str(type(var2)).find("'pkg2.foo.Pkg2_Foo'") == -1:
raise RuntimeError("failed type checking: " + str(type(var2)))
classname = str(type(var2))
# Check for an old-style class if swig was run in -classic mode
if classname == "<type 'instance'>":
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"

View file

@ -7,6 +7,12 @@ import pkg1.pkg2.foo
print " Finished importing pkg1.pkg2.foo"
var2 = pkg1.pkg2.foo.Pkg2_Foo()
if str(type(var2)).find("'pkg1.pkg2.foo.Pkg2_Foo'") == -1:
raise RuntimeError("failed type checking: " + str(type(var2)))
classname = str(type(var2))
# Check for an old-style class if swig was run in -classic mode
if classname == "<type 'instance'>":
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"

View file

@ -20,3 +20,10 @@ if grabpath() != os.path.dirname(mypath):
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError("grabstaticpath failed")
clearstaticpath()
if grabstaticpath() != None:
raise RuntimeError("Resetting staticfuncpath failed")
Test.static_func()
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError("grabstaticpath failed")

View file

@ -12,6 +12,9 @@ def grabpath():
return funcpath
def grabstaticpath():
return staticfuncpath
def clearstaticpath():
global staticfuncpath
staticfuncpath = None
%}
%pythonappend Test::func %{