The low-level API for setting static member variables stopped working
when the fastunpack option was turned on by default. The PyMethodDef
setup requires METH_O, not METH_VARARGS with fastunpack.
* ZackerySpytz-director-classes-final-methods:
Warning tweaks for destructors that are final in director classes
Documentation for directors and virtual final methods
Fixes for final destructors in director classes
Warning fix for final destructor in directors
Remove a useless warning filter
Fix the handling of director classes with final methods
Fixes wrapping overloaded functions/constructors where a vararg
function is declared after a non-vararg function.
This is a long standing bug in the Python layer exposed since fastunpack
was turned on by default.
Generated SwigDirector_* classes were attempting to override
methods marked as final.
In addition, give a warning if the destructor of a director class is
final.
Closes#564.
Tests for std::vector of pointers added which check
std::vector<T*>::const_reference and std::vector<T*>::reference
usage which gave compilation errors in Python and Perl which had
specialized these vectors incorrectly.
Fix regression introduced by 3f5c17824c
which resulted in using "$ignore" instead of the real parameter name in
Python if an %ignore/%rename($ignore) for the parameter name was used
(as could happen not necessarily intentionally when using wild card
ignores with regex matches) by explicitly checking if we're dealing with
a parameter node in apply_rename(), used by Swig_name_make(), and not
renaming it to "$ignore" in this case.
Extend the test suite to check for this case.
Closes#1460.
One of side effects of 15b369028f was that
the default values were only included in Python doc strings if we could
be sure that they could be interpreted as valid Python expressions, but
this change was actually undesirable as it may be useful to see C++
expression for the default value in the doc string even when it isn't
valid in Python.
Undo this part of the change and extend autodoc unit test to check that
this stays fixed.
Closes#1271.
* vadz-better-param-names:
Enable keyword arguments for keyword_rename unit test
Update error messages test suite
Add more tests for Python parameter renaming
Improve handling parameters clashing with language keywords
- Static method wrappers were using the 'fastproxy' approach by default.
This is inconsistent with instance method wrappers. The fastproxy approach
is now turned off by default to be consistent with instance methods.
Static method wrappers can now also be controlled using the -fastproxy and
-olddefs options.
Example:
struct Klass {
static int statmethod(int a = 2);
};
generates:
class Klass(object):
...
@staticmethod
def statmethod(a=2):
return _example.Klass_statmethod(a)
instead of:
class Klass(object):
...
statmethod = staticmethod(_example.Klass_statmethod)
- Modernise wrappers for static methods to use decorator syntax - @staticmethod.
- Add missing runtime test for static class methods and using the actual
class method.
Test added to check fixes for:
- Issue #948 and issue #1019 and issue #1273 - raw string delimiters
not being stripped off
- Issue #538 - Ruby support for "docstring" feature
The typecheck typemaps succeed for non pointers (SWIGTYPE, SWIGTYPE&,
SWIGTYPE&&) when the equivalent to C NULL is passed from the target
language. This commit implements a fix for Python to not accept a Python
None for non-pointer types.
Issue #1202
Code handling %template in the parser created a totally new top-level
module child of namespace type when handling templates inside a
namespace and copied the nodes from the previously parsed C++ template
declaration to it. However copies of this node kept their original
values of "abstracts" attribute, which contained pointers to the classes
in the original template declaration, i.e. outside of the subtree
created for the instantiated template. This, in turn, meant that during
the types resolution pass, the code in TypePass did not update the types
used in the methods of the classes appearing in the "abstracts" List,
even though it did update the types for the children of the instantiated
template subtree.
And this finally resulted in wrongly detecting overridden virtual
methods as abstract in Allocate::is_abstract_inherit() during the next
pass, as the signatures of the overridden method -- using resolved types
-- and of the method from the class pointed to by "abstract" -- using
the original types from C++ code -- didn't match.
Resolve this simply by not copying "abstracts" attributes when creating
the template subtree and doing another pass over this tree to recreate
them using the new nodes, just as it's already done for "defaultargs"
attribute, presumably for similar reasons. Note that doing another pass
over the tree is not as efficient as doing everything in a single pass,
but merging the new update_abstracts() with update_defaultargs() is not
completely obvious, so for now keep it simple and optimize it later if
necessary.
Also, add a test checking for the situation described above.
Closes#1353.
There were only needed to support Python < 2.2, and we now require at
least Python 2.6.
Conflicts:
.travis.yml
Examples/test-suite/python/autodoc_runme.py
Source/Modules/python.cxx
This is a cherry-pick and merge from patch in #1261
Fix when using -builtin and wrapping std::map, std::set, std::unordered_map or
std::unordered_set to ensure __contains__ is called. This is a wrapper for the STL
container's find method. Without it, Python will do its own slower sequence search.
- std::unordered_map compilation fix when just using std_unordered_map.i standalone
- std::unordered_multimap compilation fix when just using std_unordered_multimap.i standalone
- Add in the standalone unordered STL test cases
Closes#1319