Merge branch 'python-obfuscated-import-errors'

* python-obfuscated-import-errors:
  More Python module loading simplification
  Simpler Python module loading
  The Python module import logic has changed to stop obfuscating real ImportError problems.
This commit is contained in:
William S Fulton 2018-12-18 08:10:02 +00:00
commit 3119bc3e23
6 changed files with 282 additions and 140 deletions

View file

@ -2,6 +2,9 @@
between two packages. Specifically the pure python part is part of a package
and the C/C++ part is not in any package at all. Historically SWIG has
supported this sort of thing.
From SWIG 4.0.0 onwards, split modules are not supported by default.
The %module directive needs to be customised with the moduleimport attribute
in order to import the a global C/C++ module.
vanilla # "plane Jane" module both halves in pkg1
vanilla_split # python 1/2 in pkg1 C 1/2 in global namespace

View file

@ -1,4 +1,9 @@
%module(package="pkg1") foo
#if defined(SWIGPYTHON_BUILTIN) /* defined when using -builtin */
%module(package="pkg1", moduleimport="from $module import *") foo
#else
%module(package="pkg1", moduleimport="import $module") foo
#endif
%{
static unsigned count(void)
{