Commit graph

4,913 commits

Author SHA1 Message Date
Zackery Spytz
1be9f5fec3 [OCaml] Fix some of the OCaml examples
Update some of the OCaml examples so that they run successfully with
`make check-ocaml-examples` (important for the CI). Some of the
examples were written to depend on passed arguments.

Temporarily disable the broken std_string example.
2019-01-03 07:34:25 -07:00
William S Fulton
f17e993ed7 Remove some non-standard cruft from OCaml test-suite 2019-01-03 07:54:29 +00:00
William S Fulton
d247388fdf Merge branch 'ZackerySpytz-OCaml-out-of-source'
* ZackerySpytz-OCaml-out-of-source:
  Don't override SCRIPTDIR.
  Replace mv hack.
  [OCaml] Update OCaml for out-of-source builds
2019-01-03 07:12:31 +00:00
Zackery Spytz
f2a05bda8b Don't override SCRIPTDIR. 2019-01-02 05:01:54 -07:00
Zackery Spytz
5f941bc3c7 Replace mv hack. 2019-01-02 01:33:53 -07:00
Zackery Spytz
5c19f4de2f [OCaml] Add missing warning filters for OCaml keywords in the test suite 2018-12-31 05:55:10 -07:00
Zackery Spytz
9973628268 [OCaml] Update OCaml for out-of-source builds
This is one of the steps needed to fix the OCaml test suite.

In addition, disable the creation of toplevels by default in the OCaml
examples (toplevels are currently broken).
2018-12-29 08:24:24 -07:00
William S Fulton
315c7dab06 Remove debug display in python_pythoncode testcase 2018-12-22 18:47:34 +00:00
William S Fulton
5a388863fa director_thread test fixes for MacOS
Add extra debugging and correctly detect MacOS using __APPLE__ macro
2018-12-21 19:08:15 +00:00
William S Fulton
1faf5a879f Avoid thread name checking testing on MacOS
It's not working!
2018-12-21 09:13:09 +00:00
William S Fulton
50f223f454 Fix director_thread test for MacOS
pthread_setname_np is defined differently on MacOS
2018-12-21 09:13:09 +00:00
William S Fulton
d835c69d65 Merge branch 'java-director-thread-name'
* java-director-thread-name:
  Add changes entry for setting Java thread name
  Increased Java thread name size.
  Java directors - more generic thread name setting
  Use prctl method to get thread names, which is available on all NDK versions
  Actually, pthread_getname_np is only available in recent versions of Android (API level >= 26).
  Set thread name when attaching to Android JVM in SWIG Java director
2018-12-20 21:23:29 +00:00
William S Fulton
d9ecff1fca Merge branch 'chlandsi-master'
* chlandsi-master:
  Testcase for testing __new__ override Python 3.6 fix
  fix for creating new shadow class in python 3.6
2018-12-20 08:12:41 +00:00
William S Fulton
6e2b54be2f Testcase for testing __new__ override Python 3.6 fix
Issue #1357
2018-12-20 08:10:35 +00:00
William S Fulton
398ac5f01c Remove redundant Python options: -nocastmode -nodirvtable -noextranative -nofastproxy
Also remove redundant %module options: nocastmode, noextranative
Issue #1340
2018-12-18 19:51:32 +00:00
William S Fulton
3119bc3e23 Merge branch 'python-obfuscated-import-errors'
* python-obfuscated-import-errors:
  More Python module loading simplification
  Simpler Python module loading
  The Python module import logic has changed to stop obfuscating real ImportError problems.
2018-12-18 08:10:02 +00:00
William S Fulton
03323f5c8b The Python module import logic has changed to stop obfuscating real ImportError problems.
Only one import of the low-level C/C++ module from the pure Python module is
attempted now. Previously a second import of the low-level C/C++ module was attempted
after an ImportError occurred and was done to support 'split modules'. A 'split module' is
a configuration where the pure Python module is a module within a Python package and the
low-level C/C++ module is a global Python module. Now a 'split module' configuration is
no longer supported by default. This configuration can be supported with a simple
customization, such as:

  %module(package="mypackage", moduleimport="import $module") foo

or if using -builtin:

  %module(package="mypackage", moduleimport="from $module import *") foo

instead of

  %module(package="mypackage") foo

See the updated Python chapter titled "Location of modules" in the documentation.

Closes #848 #1343
2018-12-16 16:41:39 +00:00
Robert Stone
871ece78e6 repair uses of EXTEND() in Perl typemaps
closes #1374
 * enhance testing around multiple return values
   Examples/test-suite/perl5/scilab_multivalue_runme.pl fails in
   perl-5.28.1 compiled with -DDEBUGING without the typemap updates
 * repair EXTEND() handling in typemaps
 * Use PL_sv_undef for VOID_Object
2018-12-11 15:51:14 -08:00
William S Fulton
51dadaeacd Add example to test the Python module being renamed to __init__.py
This examples tests the SWIG generated module being placed into a directory and
then renamed __init__.py to convert the module into a package. This ability
stopped working in swig-3.0.9. However, only Python 2.7 or 3.3 and later work. If
Python 3.2 support is needed, use moduleimport in %module to customise the import
code.

Issue #1282
2018-12-08 22:31:26 +00:00
William S Fulton
525c757322 Merge branch 'vadz-add-nested-in-template-test'
* vadz-add-nested-in-template-test:
  Avoid comparing doubles in nested_in_template.i unit test
  Add recently added nested_in_template to the list of test cases
2018-12-06 07:21:04 +00:00
William S Fulton
84dcb9bfff Revert "Temporarily remove Python import_packages testcase"
This reverts commit 8d6f3010ea.
2018-12-06 06:55:24 +00:00
William S Fulton
ff93f2e26e Skip Python subprocess calls in import_packages testcase on Windows
Getting these kind of errors on Appveyor which uses mingw/cygwin to run
a Python interpreter:

Native windows Python 3.6 running under cygwin and mingw Python 3.7 running under mingw:
  Fatal Python error: _Py_HashRandomization_Init: failed to get random
  numbers to initialize Python

Cygwin Python 2.7 running under cygwin:
  0 [main] python2.7 496 child_info_fork::abort: address space needed by '_foo.dll' (0x6D0000)
  is already occupied
2018-12-06 06:50:57 +00:00
William S Fulton
8d6f3010ea Temporarily remove Python import_packages testcase
The subprocess.check_call seems broken on Windows, needs investigation.
2018-12-04 22:35:47 +00:00
Vadim Zeitlin
5e7426dcc6 Avoid comparing doubles in nested_in_template.i unit test
This should also have been part of
30bb977a64

See #1358.
2018-12-04 20:46:35 +01:00
William S Fulton
604ae7186b Fix for running 'python -m' when using swig -builtin
Same as e05b5ea for -builtin.

Also added runtime tests to check 'python -m'.
2018-12-04 19:12:13 +00:00
William S Fulton
9e83d5d5d9 Fix nstest.py test
Use subprocess.check_call as os.system won't stop the test in case of
errors.
2018-12-04 06:49:55 +00:00
William S Fulton
6030f59741 Fix operator Python example for -builtin
Output was incorrect for -builtin as custom __str__ was not being
called.
2018-11-28 08:18:28 +00:00
Vadim Zeitlin
73ea48ba4a Add recently added nested_in_template to the list of test cases
This should have been part of 30bb977a64

See #1358.
2018-11-25 23:39:15 +01:00
Vadim Zeitlin
30bb977a64 Fix handling of abstract base classes nested inside templates
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.
2018-11-24 19:21:47 +01:00
William S Fulton
c0481ce99d Add Python runtime test for const function pointer 2018-11-13 07:35:44 +00:00
William S Fulton
7d6bb6cd44 Add missing run of the functors testcase 2018-10-22 08:19:50 +01:00
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
3195c3e4da Java directors - more generic thread name setting
Activated if a user sets SWIG_JAVA_USE_THREAD_NAME.
Implementations provided for linux/android/macos/unix.
A user's implementation will be used if SWIG_JAVA_GET_THREAD_NAME is
defined. It must implement the function:
  namespace Swig {
    SWIGINTERN int GetThreadName(char *name, size_t len);
  }
2018-10-08 21:38:41 +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