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:
parent
415186c1f4
commit
1c4ec59e45
8 changed files with 44 additions and 15 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
Version 1.3.37 (in progress)
|
Version 1.3.37 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2008-12-02: wsfulton
|
||||||
|
[Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes
|
||||||
|
when the package option is specified in %module and that module is %import'ed.
|
||||||
|
|
||||||
2008-11-28: wsfulton
|
2008-11-28: wsfulton
|
||||||
[UTL] Fix some incorrect acceptance of types in the STL, eg a double * element passed
|
[UTL] Fix #2080497. Some incorrect acceptance of types in the STL, eg a double * element
|
||||||
into a vector<int *> constructor would be accepted, but the ensuing behaviour was
|
passed into a vector<int *> constructor would be accepted, but the ensuing behaviour
|
||||||
undefined. Now the type conversion correctly raises an exception.
|
was undefined. Now the type conversion correctly raises an exception.
|
||||||
|
|
||||||
2008-11-24: wsfulton
|
2008-11-24: wsfulton
|
||||||
Add -outcurrentdir option. This sets the default output directory to the current
|
Add -outcurrentdir option. This sets the default output directory to the current
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
class A
|
struct Base {
|
||||||
{
|
virtual int vmethod() { return 1; }
|
||||||
public:
|
int basemethod() { return 1; }
|
||||||
int testInt() { return 2;}
|
virtual ~Base() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
packageoption_a
|
packageoption_a
|
||||||
packageoption_b
|
packageoption_b
|
||||||
|
packageoption_c
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%module(package="C") "packageoption_a";
|
%module(package="CommonPackage") "packageoption_a";
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
class A
|
class A
|
||||||
|
|
@ -6,5 +6,11 @@ class A
|
||||||
public:
|
public:
|
||||||
int testInt() { return 2;}
|
int testInt() { return 2;}
|
||||||
};
|
};
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include "packageoption.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
%include "packageoption.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%module(package="C") "packageoption_b";
|
%module(package="CommonPackage") "packageoption_b";
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
class B
|
class B
|
||||||
|
|
|
||||||
13
Examples/test-suite/packageoption_c.i
Normal file
13
Examples/test-suite/packageoption_c.i
Normal 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() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
@ -14,11 +14,11 @@ sub ok_not ($;$) {
|
||||||
ok($test, $name);
|
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');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -925,7 +925,11 @@ public:
|
||||||
if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
|
if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
|
||||||
Printf(import, "_%s\n", modname);
|
Printf(import, "_%s\n", modname);
|
||||||
if (!Strstr(f_shadow_imports, import)) {
|
if (!Strstr(f_shadow_imports, import)) {
|
||||||
|
if (pkg && (!package || Strcmp(pkg, package) != 0)) {
|
||||||
|
Printf(f_shadow, "import %s.%s\n", pkg, modname);
|
||||||
|
} else {
|
||||||
Printf(f_shadow, "import %s\n", modname);
|
Printf(f_shadow, "import %s\n", modname);
|
||||||
|
}
|
||||||
Printv(f_shadow_imports, import, NULL);
|
Printv(f_shadow_imports, import, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue