Commit graph

660 commits

Author SHA1 Message Date
William S Fulton
7aa5f07dfd Fix 'make partialcheck-test-suite'
Python pep8 should not be run as part of partialcheck
Javascript should also only invoke SWIG during partialcheck
2016-03-18 18:56:55 +00:00
William S Fulton
ac495d5c66 Merge branch 'char-escaping'
* 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
2016-03-12 23:27:51 +00:00
William S Fulton
0f0345c214 Merge branch 'interfaces'
* 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
2016-03-11 20:01:41 +00:00
William S Fulton
4a3e1fd44c Add rstrip encoder for use in %rename.
This is like the strip encoder but strips the symbol's suffix instead
of the prefix.
2016-03-02 07:11:09 +00:00
William S Fulton
155e31626c Duplicate tests that are run twice as both C and C++ tests to fix parallel make: overload_extend 2016-02-21 19:24:11 +00:00
William S Fulton
0bd41dc14d rename overload_extendc testcase 2016-02-21 18:04:04 +00:00
William S Fulton
a00b4f4463 Duplicate tests that are run twice as both C and C++ tests to fix parallel make: li_cpointer 2016-02-21 18:04:04 +00:00
William S Fulton
819bd9c97e Duplicate tests that are run twice as both C and C++ tests to fix parallel make: li_cdata 2016-02-21 18:04:04 +00:00
William S Fulton
9600c95234 Duplicate tests that are run twice as both C and C++ tests to fix parallel make: li_carrays 2016-02-21 18:04:04 +00:00
William S Fulton
78b113558f Duplicate tests that are run twice as both C and C++ tests to fix parallel make: keyword_rename 2016-02-21 18:04:04 +00:00
William S Fulton
bc3bf51af2 Duplicate tests that are run twice as both C and C++ tests to fix parallel make: empty 2016-02-21 18:03:14 +00:00
William S Fulton
bb01ed3286 Merge branch 'ahnolds-classic_python'
* 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
2016-02-06 08:01:08 +00:00
Alec Cooper
17a4143dd0 Tests for Python Bytes/Unicode distinction 2016-02-04 21:07:40 -05:00
Alec Cooper
b45164e098 Support python(pre|ap)pend on static methods in classic mode
Adding a test that covers this case to the python_append test-suite
Note: staticmethod function has been available since Python 2.2
2016-02-04 15:27:54 -05:00
William S Fulton
26d0b7f5b9 Disable tests broken in python 2.4 and 2.5
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.
2016-02-04 08:36:58 +00:00
William S Fulton
62c34fc9d9 Add tests for enum values and static const member variables chars containing escape sequences 2016-01-26 20:16:47 +00:00
Ben Webb
2a5bbb6018 Qualify use of "__builtin__.Exception" class.
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).
2016-01-11 21:43:10 -08:00
Alec Cooper
fc8e76544c Unit tests for ptrdiff_t/size_t max/min in Python 2016-01-06 17:45:21 -05:00
Alec Cooper
2f8a7b822d Adding unit tests for Python primitive type conversions
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
2015-12-23 19:04:27 -05:00
William S Fulton
01611702ec Python 2 Unicode strings can be used as inputs to char * or std::string types
Requires SWIG_PYTHON_2_UNICODE to be defined when compiling generated code.
2015-12-19 03:55:26 +00:00
William S Fulton
b15ad9349e Merge branch 'coleb-python35_dtor_exception_fix'
* 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.
2015-12-16 12:58:01 +00:00
William S Fulton
26f52c53f4 Add test case for Python 3.5 assertion with a pending StopIteration
Testcase for issue #559 #560 #573
2015-12-16 12:57:06 +00:00
William S Fulton
dd73d81933 Amend python_destructor_exception runtime test
Suppress the message that PyErr_WriteUnraisable writes to stderr,
but check that it is called by checking some of the expected message contents.
The output varies slightly for different versions of Python and -builtin
2015-12-16 12:57:05 +00:00
Brian Cole
a863e98874 Extended zjturner's changes to encompass all function dispatch and use PyErr_WriteUnraisable to handle exceptions during __del__.
Also added test cases for the unnamed temporary destruction that is throwing assertions in Python 3.5.
2015-12-15 08:39:55 -07:00
William S Fulton
93eb7eae0b Limited Python/Ruby support for boost::array
Hack to use the std::array support for boost::array.
Is limited as it currently exposes some 'using' bugs in SWIG.
For example, the type system fails to see that pointers to std::array
and pointers to boost::array are the same.

This approach saves having to maintain separate boost::array support.
The 'using' bug ought to be fixed, otherwise separate boost_array.i
files could be easily made from the std_array.i files.
2015-11-27 19:30:22 +00:00
William S Fulton
55bbf68512 Add std::array container wrappers for Python
These work much like any of the other STL containers except Python slicing
is somewhat limited because the array is a fixed size. Only slices of
the full size are supported.
2015-11-17 07:27:48 +00:00
William S Fulton
593c452c37 Fix overloaded templates and default arguments
The defaultargs attribute was not being correctly set for functions with
default arguments when instantiated with %template.

Closes #529
2015-10-11 17:30:34 +01:00
William S Fulton
3e9854d308 Fix incorrect director_classic_runme.py test
Python 3.5 and -builtin threw an error as the incorrect base was being
initialized.
2015-10-10 01:26:29 +01:00
William S Fulton
04fd4a9c68 Director smartptr testing - add Python test 2015-10-01 22:36:00 +01:00
William S Fulton
4c2da8184b li_boost_shared_ptr tests cleanup
Remove some cruft
2015-09-25 23:14:34 +01:00
Olly Betts
8ab622c6d0 [Python] Fix docstrings for %callback functions
Reinstates autodoc for callback function testcase from #467, actually
tests the resulting docstring in the _runme.py and fixes SWIG/Python
so the expected result is obtained.
2015-09-04 13:04:37 +12:00
Olly Betts
aa0e781034 Suppress pep8 E731 (lambda assignment)
This is a new warning in pep8 1.6.0 which breaks our testsuite.
2015-09-04 12:50:52 +12:00
William S Fulton
ca64b06229 Consistent quoting in Makefile 2015-08-21 22:48:34 +01:00
xantares
92328a2016 pep257 & numpydoc conforming docstrings 2015-08-07 22:15:13 +01:00
Vadim Zeitlin
a1bddd56eb Make (char*, size_t) typemap usable for strings of other types in Java.
Notably it now works for "unsigned char*" strings.

Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
2015-08-07 19:44:45 +02:00
William S Fulton
fa282b3540 Improve Python docstring indentation handling
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring
feature.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of
truncating the docstring text.
Now the indentation for the 'docstring' feature is smarter and is
adjusted so that no truncation occurs.

Closes #475
2015-07-30 08:26:08 +01:00
William S Fulton
3718b810c7 Don't generate constructor wrappers if a base class has a private constructor
g++-5 errors out with this now with errors such as:

default_constructor_wrap.cxx:665:27: error: use of deleted function ‘FFF::FFF()’
   result = (FFF *)new FFF();
                           ^
default_constructor_wrap.cxx:314:7: note: ‘FFF::FFF()’ is implicitly deleted because the default definition would be ill-formed:
 class FFF : public F {
       ^
default_constructor_wrap.cxx:301:4: error: ‘F::~F()’ is private
    ~F() { }
    ^
default_constructor_wrap.cxx:314:7: error: within this context
2015-07-07 20:15:55 +01:00
Olly Betts
822b2355c0 Improve handling of whitespace in %pythoncode
Previously SWIG looked at the indentation of the first line and removed
that many characters from each subsequent line, regardless of what those
characters were.  This was made worse because SWIG's preprocessor removes
any whitespace before a '#'.  Fixes github issue #379, reported by Joe
Orton.
2015-06-29 22:12:38 +12:00
William S Fulton
b8e1a66a38 Add new feature "python:cdefaultargs"
Controls default argument code generation to obtain the default
arguments from the C++ layer instead of the Python layer.
2015-05-28 20:11:57 +01:00
William S Fulton
986a13f1a0 Fix Python typedef bool default arguments that are not booleans.
Includes code optimisation in PYTHON::convertValue().

Closes #327
2015-05-27 20:55:56 +01:00
William S Fulton
0f94ea9208 Example and test-suite makefile tidy up
Python output is less verbose if pep8 is not available (tweaks for patch #416)
2015-05-11 00:09:40 +01:00
Jon Schlueter
b77f3afafb autopep8 cleanup of Examples/test-suite/python
automated cleanup of python pep8 whitespace compliance
2015-05-08 21:35:52 -04:00
Olly Betts
c2972b8bf0 [Python] Deal with an integer as the default value of a bool
parameter in the C++ prototype.  Fixes github #327, reported by
Greg Allen.
2015-05-07 16:25:32 +12:00
Vadim Zeitlin
6988b00aba Fix handling of default arguments after ignored ones in Python.
Don't skip checking subsequent arguments just because one of them has "in"
typemap with numinputs=0 attribute.

Add a unit test showing the problem which is relatively rare as it doesn't
happen for the class methods and is hidden unless autodoc feature is used for
the global functions.

Closes #377.
2015-04-27 23:17:14 +02:00
William S Fulton
416277b3a5 Python code generated with '-builtin -modernargs' segfaults for any method taking zero arguments.
Also fixes: "SystemError: error return without exception set" during error checking
when using just -builtin and the incorrect number of arguments is passed to a class
method expecting zero arguments.

Closes #256
Closes #382
2015-04-24 21:08:17 +01:00
Vadim Zeitlin
5569d91bd0 Fix handling of "default" typemap in Python.
Use "compact" arguments form for the function if "default" typemap is defined
for any of its arguments to allow omitting this argument when calling it from
Python.

Closes #377.
2015-04-23 15:11:05 +02:00
Vadim Zeitlin
0eae8a8efa Fix handling of NULL default argument values for pointer types.
Accept not only manifest pointer types (such as e.g. "void *") but also types
that are typedefs for pointer types when checking whether C++ value of 0 must
be represented as 0 or None in Python.

Closes #365, #376.
2015-04-23 15:11:02 +02:00
William S Fulton
1a64e74c46 Add python runtime test for dynamically added attributes
From #320
2015-04-11 12:35:58 +01:00
William S Fulton
f1213809a2 Fix python tests for old versions of Python 2015-01-31 17:39:36 +00:00
William S Fulton
76bcec1d87 Test-suite fixes for python -classic
These are mostly workarounds for static class members not being supported for
old style classes, as documented in Python.html, "C++ classes".
2015-01-31 15:04:35 +00:00