When several modules define classes with the same name,
only the module imported first works properly.
For example if I have two modules (a and b) each
defining a class named MyClass, the following code will
ma = a.MyClass()
But the following will raise an exception:
mb = b.MyClass()
It seems that python can't make up its mind whether mb
is of type b.MyClass or a.MyClass.
The problem has appeared with SWIG 1.3.22 and is still
present in 1.3.25.
The attached zip contains the following files:
- a.i and b.i: SWIG sources for both modules;
- build.bat: a windows batch file to build the modules
- go.py: a sample script showing the problem;
- output.txt: a copy of the output I get from go.py;
- build/*: binaries built with SWIG 1.3.25, mingw-gcc
3.4.2 and Python 2.3.