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.
This suite fails on Python 3 (with and without -builtin) due to the following issues:
- Operator / is mapped to the div slot which is now truediv in Python3 (see PR #136 for a WIP fix).
- Operators +=, -=, *= and probably others assign the method return type (void) to the object they are applied on. A workaround is to return *this from the affected operators.
* ahnolds-classic_python:
Updating changelog and marking -classic as passing CI
Support checking names of old-style classic classes
Don't claim to new-style support in classic mode
Clean up setting _object
Removing __swig_getmethods__ for static methods
Support python(pre|ap)pend on static methods in classic mode
Add support for static methods in classic mode
When possible, use PyInt rather than PyLong
These tests were added in 2f8a7b82 and fc8e7654 in #572 and #573
but a change from a few months ago meant that the requested version of
Python was not actually being used during testing when these were added.
It is possible that the module we're wrapping defines an Exception
class. This will confuse code that uses an unqualified "Exception"
class (e.g. "try: ... except Exception") since it now won't match
the Python builtin Exception. Fix this by explicitly using
the class from the __builtin__ module ("builtins" in Python 3).
Adding unit tests for operator overloading to determine which overload was chosen
Allow TypeError when testing overloads since it is generated instead
of NotImplementedError when swig is run with -O or -fastdispatch
* coleb-python35_dtor_exception_fix:
Add test case for Python 3.5 assertion with a pending StopIteration
Amend python_destructor_exception runtime test
Call PyErr_WriteUnraisable if a destructor sets a Python exception (-builtin)
Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
Python - Save and restore exception state before calling destroy.