Apply patch #2143727 for Python from Serge Monkewitz to fix importing base classes when the package option is specified in %module and that module is %import'ed

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10960 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-02 20:21:16 +00:00
commit 1c4ec59e45
8 changed files with 44 additions and 15 deletions

View file

@ -1,5 +1,6 @@
class A
{
public:
int testInt() { return 2;}
struct Base {
virtual int vmethod() { return 1; }
int basemethod() { return 1; }
virtual ~Base() {}
};

View file

@ -1,2 +1,3 @@
packageoption_a
packageoption_b
packageoption_c

View file

@ -1,4 +1,4 @@
%module(package="C") "packageoption_a";
%module(package="CommonPackage") "packageoption_a";
%inline %{
class A
@ -6,5 +6,11 @@ class A
public:
int testInt() { return 2;}
};
%}
%{
#include "packageoption.h"
%}
%include "packageoption.h"

View file

@ -1,4 +1,4 @@
%module(package="C") "packageoption_b";
%module(package="CommonPackage") "packageoption_b";
%inline %{
class B

View file

@ -0,0 +1,13 @@
%module(package="PackageC") "packageoption_c";
%import "packageoption_a.i"
%inline %{
#include "packageoption.h"
struct Derived : Base {
virtual int vmethod() { return 2; }
virtual ~Derived() {}
};
%}

View file

@ -14,11 +14,11 @@ sub ok_not ($;$) {
ok($test, $name);
}
my $a = C::A->new();
my $a = CommonPackage::A->new();
isa_ok($a, 'C::A');
isa_ok($a, 'CommonPackage::A');
my $b = C::B->new();
my $b = CommonPackage::B->new();
isa_ok($b, 'C::B');
isa_ok($b, 'CommonPackage::B');