Commit graph

4,881 commits

Author SHA1 Message Date
Olly Betts
e4fceee12f Hard-wire -modern and -modernargs on
What SWIG calls "modern" classes are supported by Python 2.3 and up
which means they're supported by all the Python versions we aim to
support in 4.0.0.

 Conflicts:
	Source/Modules/python.cxx

This is a cherry-pick and merge from the patch in #1261
2018-10-12 07:10:47 +01:00
Olly Betts
728b8955bd Drop support for Python classic classes
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
2018-10-12 07:10:47 +01:00
William S Fulton
dcbccc6f6f Test non-default compare template argument in std::map 2018-10-09 22:43:19 +01:00
William S Fulton
220a735ec5 Update php test 2018-10-09 19:37:07 +01:00
William S Fulton
84f7b740ea Fix testcase for visual studio (2) 2018-10-05 06:52:49 +01:00
William S Fulton
94377ef3ed Fix testcase for visual studio 2018-10-04 19:09:11 +01:00
William S Fulton
18383340e9 Fix C default arguments with -builtin and -fastunpack and -modernargs.
Problem occurred when there is just one (defaulted) parameter in the parameter list.

Closes #1126
2018-10-04 08:06:01 +01:00
William S Fulton
b90e3ae35d C# directors override/virtual - additional testing
Add runtime test for scenario described in #1323.
Expand testing to cover a mix of override/virtual method overloading.
Remove testSwigDerivedClassHasMethod() test - not fixed yet.
2018-09-25 19:40:35 +01:00
Rokas Kupstys
e4a251f321 Add new keywords for non-verriding methods in director_basic test. 2018-09-25 19:39:53 +01:00
Rokas Kupstys
ea3140a981 Improve correctness of SwigDerivedClassHasMethod() tests
Tests first added in issue #1323
2018-09-25 19:39:02 +01:00
William S Fulton
7eba1cfea1 Testcase code correction 2018-09-24 07:15:59 +01:00
William S Fulton
631e26ae48 Python std::unordered_set tidy up and additional testing 2018-09-23 19:10:26 +01:00
William S Fulton
72ccea5080 Python std::unordered_map std::unordered_multimap improvements
- Fixes for -builtin
- Fix missing iterator support
2018-09-23 19:10:00 +01:00
William S Fulton
146998ce81 Python builtin - add indexing support to std::unordered_set 2018-09-23 19:09:59 +01:00
William S Fulton
05d6717de9 Python builtin - add indexing support to std::set 2018-09-23 19:09:54 +01:00
William S Fulton
4715a4e72c Python -builtin __contains__ fix for map and set like containers.
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.
2018-09-21 08:51:22 +01:00
William S Fulton
333209595d Python builtin test fix for non-builtin 2018-09-19 23:33:16 +01:00
luz.paz
ed28e7cbe2 Misc. typo and whitespace fixes
Found via `codespell -q 3 -L "uint,bae,objext,cmo,goin,struc,ois,upto"`
whitespaces were unintentionally fixed due to my editors settings.

Rebased patch #1327
2018-09-19 20:29:14 +01:00
William S Fulton
c6547ac44e Fix functors (wrapped as __call__) when using -builtin -modern -fastunpack. 2018-09-19 20:10:11 +01:00
William S Fulton
bf85b6f7a9 Add in an example/test for Python __pow__
- A test for the ternaryfunc builtin slot
- Example of how to wrap C++ class for Python's pow
2018-09-16 17:33:14 +01:00
William S Fulton
4d34d419b6 Disable nondynamic testcase for Python -builtin -O 2018-09-06 21:22:51 +01:00
Rokas Kupstys
0a102e2846 Fix class having method Connect() creating a name collision with SwigDirectorConnect().
Issue is fixed by prepending director methods with `SwigDirectorMethod` instead of `SwigDirector`.
2018-09-06 12:43:51 +03:00
William S Fulton
de5a2c496b Python runtime test invalid sequence fix
Fixes:
  DeprecationWarning: invalid escape sequence \]
shown using debug build of python-3.7 interpreter.
2018-09-04 07:35:41 +01:00
William S Fulton
de7fa2c499 Merge branch 'ChristopherHogan-chogan/guile_gc'
* ChristopherHogan-chogan/guile_gc:
  Run garbage collection in test for guile >= 2.0.12
  Fix garbage collection for guile >= 2.0.12
2018-09-01 09:53:02 +01:00
William S Fulton
2f31c3e94e Python C++11 hash tables compilation fixes
- 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
2018-08-31 20:26:46 +01:00
Chris Hogan
63b689d7cd Run garbage collection in test for guile >= 2.0.12 2018-08-22 08:39:50 -05:00
William S Fulton
f7818d5ed3 Simplify nested testcase
Remove duplicate code (that just had shorter names for Scilab).
2018-08-20 19:28:29 +01:00
William S Fulton
3baf6e9f97 Merge branch 'wkalinin-duplicate-unions'
* wkalinin-duplicate-unions:
  Add testcase for nested C struct name conflict
  Nested structures in "C" mode symbol table fix
2018-08-20 19:22:31 +01:00
William S Fulton
c39a379942 Add testcase for nested C struct name conflict
Issue #1305
2018-08-20 19:21:14 +01:00
William S Fulton
eb81355196 Fix makefile recursion when running python test-suite.
Use terminal / double-colon rules in makefile pattern matching rule to
prevent recursion reported on some versions of make.

Closes #688
2018-08-19 17:40:56 +01:00
William S Fulton
4930fab5a0 Fix some Python tests not being run in out of source tree builds
When there is just a _runme3.py file and no _runme.py file, out of
source builds were not running the script.
Currently only applies to python_abstractbase_runme3.py.
2018-08-19 16:18:38 +01:00
William S Fulton
c9cac931c7 Re-implement Python -fastproxy option.
The previous implementation failed with Python 3 and abstract base clases.
The new implementation replaces the Python 2 implementation using new.instancemethod with C API PyMethod_New to match the equivalent Python 3 implementation which uses PyInstanceMethod_New.

Closes #1310
2018-08-18 00:36:23 +01:00
William S Fulton
bb5c46079b Better detection of builtin in Python testcase 2018-08-14 19:16:25 +01:00
William S Fulton
345b4fec43 Testcase fix 2018-08-14 08:55:55 +01:00
William S Fulton
fdd2bcf0e6 Remove asserts from Python testcase
Also rename testcase python_pybuf to python_pybuffer.
2018-08-12 15:16:03 +01:00
William S Fulton
4313c2c168 Update pybuffer.i library to use new-style Python buffer C API.
Removed old API altogether as Python 2.7 is now the minimum version
supported and it supports the new-style buffer API.
2018-08-12 15:02:28 +01:00
William S Fulton
33f3dbb005 Merge branch 'gmazzamuto-pybuf_test'
* gmazzamuto-pybuf_test:
  pybuffer: don't use the old deprecated buffer protocol for Python 3
  Enable test case for python_pybuf
2018-08-12 14:19:40 +01:00
William S Fulton
61d9dd40a0 Fix crash Java directors
Further crash fixes when using OUTPUT and INOUT typemaps in typemaps.i and
passing NULL pointers in C++ to director method overloaded and implemented
in Java.

Don't create the one element array in these directorin typemaps if the
input is a NULL pointer, that is, translate a NULL C++ pointer into a
null Java object.

Also add some missing JNI error checks in these typemaps.
2018-08-12 13:45:43 +01:00
William S Fulton
99f8e12d32 Java director typemaps.i testing for pointers added
Copy java_director_typemaps testcase to test pointers instead of references.
2018-08-11 17:11:24 +01:00
William S Fulton
4f7406624d Python fastdispatch error message improvements
When overloaded C++ methods are called, the fastdispatch mode sometimes
optimises out the generation of the typecheck typemap code, resulting in
the 'Possible C/C++ prototypes' information not being in the error message.
Now when a TypeError is thrown, the exception message is modified to contain the
'Possible C/C++ prototypes'.

See issue #1293
2018-08-10 08:14:19 +01:00
William S Fulton
fd651ff4e2 Overloaded C++ function Python wrappers now raise a TypeError instead of NotImplementedError
Occurs when the types passed are incorrect. This change means
there is now consistency with non-overloaded function wrappers which have always
raised TypeError when the incorrect types are passed.

See issue #1293
2018-08-10 08:14:12 +01:00
William S Fulton
037bf2b385 Slim down pythonnondynamic testing feature testing
No need to test twice, just test using C.
2018-07-23 07:27:01 +01:00
William S Fulton
fe082382c7 Fix pythonnondynamic feature for modern classes
Fixes nondynamic mode when an instance variable is set with the same
name as a class variable in a class derived from a SWIG proxy class.
The python_nondynamic testcase now works using -modern and testcase
enhanced slightly too.

Fixes #718
2018-07-23 07:25:11 +01:00
Giacomo Mazzamuto
5a8c4fde4c Enable test case for python_pybuf 2018-07-04 10:48:06 +02:00
William S Fulton
602b0d5a2c Add doxygen testing of Java constructor wrappers 2018-06-18 18:56:21 +01:00
William S Fulton
9cc05724ef Add java runtime test for nested classes 2018-06-18 18:55:14 +01:00
William S Fulton
c5f9bb1e41 Add doxygen test for nested classes 2018-06-18 07:43:27 +01:00
William S Fulton
ecc66fdcbd Add Doxygen test for constant and fix JavaDoc indentation 2018-06-17 00:17:07 +01:00
William S Fulton
d22ecafb36 Fix Java doxygen:notranslate for single line comments
Remove extra generated line
2018-06-16 21:23:12 +01:00
William S Fulton
e96316bf31 Fix seg fault using Python 2 invalid utf-8 strings and wstring
Fixes seg fault when passing a Python string, containing invalid utf-8 content,
to a wstring or wchar * parameter.  A TypeError is thrown instead, eg:

  %include <std_wstring.i>
  void instring(const std::wstring& s);

  instring(b"h\xe9llooo") # Python
2018-06-15 19:39:12 +01:00