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
These are not working yet for all combinations of builtin and PY3
The goal is to have a sensible default error that states that
pickling is not supported.
The metaclass (SwigPyObjectType) for SWIG objects was not defined in
a way that let importlib successfully import the Python wrappers.
The pickle module failed because it couldn't determine what module the
SWIG wrapped objects are in.
I've changed the definition of SwigPyObjectType using more normal
builtin type definitions. There are still some open questions:
- None of the builtin types, like swig_static_var_getset_descriptor and
SwigPyObject are added into any module. No call to PyModule_AddObject
is made, so isinstance cannot be used for any wrapped type, all of
which are derived from SwigPyObject.
Closes#808
The closure names used for builtin slots are mangled with their functype so
that overloaded C++ method names can be used for multiple slots.
For example:
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
will generate closures:
SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
Default hash is the underlying C/C++ pointer.
This matches up with testing for equivalence (Py_EQ in SwigPyObject_richcompare)
which compares the pointers.
If the wrong return type in the hash function was used, an error:
SystemError: error return without exception set
was raised
Add some tests for testing builtin slots
Also fixes -O.
This is a minimal change avoiding the differences in the function names
when -fastproxy is used until autodoc code is improved with doxygen
changes.
Closes#721.
Testcase has now been modified to mask the problem by providing the default parameter 'int' in:
%shared_ptr(Space::BaseDefault<short, int>)
If this is not done then d fails to convert to BaseDefault<short>&
This needs fixing in SWIG, but the problem is masked for now, so that the python
testcase works when run with the -O option.
Fixes SF bug 3333549 - %shared_ptr fixes when the type is a template using
template parameters that are typedef'd to another type.
Also fixes python -O optimization where the smart pointer conversion to the
base class needs to work because of the virtual methods that have been
optimized away.
* ejulien-python_operator_overload_test_suite:
Add __str__ to operator_overload testcase for python builtin
Python operator_overload runtime testcase cleanup
Work around a limitation of the Python binding generator related to the += family of operators.
Fix Python 3 division member operator when -builtin is not used.
Fix class member division operator.
Remove the PY3BUILTIN switch as its behavior can be achieved with the existing SWIG_FEATURES=-builtin switch.
Implement the operator overload test suite for Python.
Conflicts:
Examples/test-suite/operator_overload.i
* char-escaping:
Add missing string_constant.i testcase
changes file update for char wrappers
C# char wrappers fixes for enum values, static const member char values and %csconst
D testing added for %dmanifestconst and char constants
Fix wrapping D constants using %dmanifestconst
Php fix for enum value of '\0'
Fix static const char member variables wrappers with %javaconst(1).
Expand char testing in enums and %constant
Java char changes file update
Java enum and static member variable escaping fix for chars
Add tests for enum values and static const member variables chars containing escape sequences
Minor documentation tweak
Conflicts:
CHANGES.current
* interfaces:
Documentation and CHANGES entry for interface feature
interface macro argument name tweaks
Change the name of the interface in %feature to be more portable
Interface feature fix for typedef types
Add limited support for %interface_impl and %shared_ptr
Multiple inheritance warning wording tweak
C# "override" fix for "extend" case
Add checks for interface name symbol clashes
interface feature test changes for the tests to pass for all languages
Rename feature_interface.i to swiginterface.i
Re-organization of the interface feature common code
Port Java interface tests to C#
Test %interface
Test %interface_impl
Use rstrip instead of regex encoder in %feature_rename
Add rstrip encoder for use in %rename.
Interface macros: %interface %interface_impl %interface_custom
Add $interfacename family of special variable expansions
Add multiple_inheritance_nspace testcase
Interface name handling improvements and special variable changes
Correct regex example comment
Properly hide unexposed naming functions in naming.c
C++ namespace testing for interface feature
interface feature - SWIG_JAVABODY_PROXY does not need to be overridden
Support namespaces and nspace with the interface feature for C#
Support namespaces and nspace with the interface feature for Java
Cosmetic test case changes
Add Java premature garbage collection prevention parameter (pgcpp) to interface feature
Create javainterfacecode and csinterfacecode typemaps
IntPtr & HandleRef absolute names used
virtual/override fix
Improve interface feature checks
Add another interface test selecting just one base as an interface
Comments added to interface feature implementation and cosmetic code changes
Add overloading tests for interface feature
Refactor multiple inheritance warnings
director generation fixes
interface feature updates for C# latest on master
interfaces branch merge fixes
Remove unnecessary interfaces for concrete classes
cosmetic code formatting changes
Correct interface name attributes that are internal
interface macro changes to support templates
Test non-virtual method in Derived classes
interface tests for a most derived class inheriting the interfaces further up the chain
Rename GetCPtr/getCPtr to SWIGInterfaceUpcast
interface feature support for const ref pointers (used by the STL)
Interface feature support for arrays
More interface feature testing for return values
interface feature support for passing by value
interface feature support for references
Multiple inheritance parameters as pointers testing
Simplify multiple_inheritance_abstract Java runtime test
Warning fixes
Rename test functions in multiple_inheritance_abstract testcase
Formatting fixes in generated code for interface feature
Cosmetic spacing changes in test case
interface feature typemap corrections to handle NULL pointers
interface test added
javadirectorin fix
interface implementation visibility
interface inheritance (2)
interface inheritance (1)
feature:interface ported to Java
propagate non-abstract "interface" base methods (3)
propagate non-abstract "interface" base methods (2)
propagate non-abstract "interface" base methods (1)
namespace support added GetCPtr now returns HandleRef "feature:interface:name" is now mandatory attribute
interfaces (1)
interfaces (1)
Conflicts:
CHANGES.current
Define the nb_divide/nb_inplace_divide slots in the interface and use it them as nb_divide/nb_inplace_divide for Python 2.x and as nb_true_divide/nb_inplace_trus_divide for Python 3.x.
The Python 3.x nb_floor_divide/nb_inplace_floor_divide slots (operator // in Python) are not populated by the interface.