Custom Python module importing code
Add optional moduleimport attribute to %module so that the default module import code can be overridden. See the "Searching for the wrapper module" documentation in Python.html. Example: %module(moduleimport="import _foo") foo $module also expands to the low-level C/C++ module name, so the following is the same as above %module(moduleimport="import $module") foo Issue https://github.com/swig/swig/issues/769
This commit is contained in:
parent
da1dd2ffd2
commit
2a42031b08
6 changed files with 135 additions and 56 deletions
7
Examples/test-suite/python/python_moduleimport_runme.py
Normal file
7
Examples/test-suite/python/python_moduleimport_runme.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import python_moduleimport
|
||||
|
||||
if python_moduleimport.simple_function(99) != 99:
|
||||
raise RuntimeError("simple_function")
|
||||
|
||||
if python_moduleimport.extra_import_variable != "custom import of _python_moduleimport":
|
||||
raise RuntimeError("custom import")
|
||||
Loading…
Add table
Add a link
Reference in a new issue