Commit graph

1,010 commits

Author SHA1 Message Date
William S Fulton
d1b93f2c0e Merge branch 'feature/python-builtin-separate-runtime-data'
* feature/python-builtin-separate-runtime-data:
  Rework swig_and_compile_multi_cpp makefile helper
  Different capsule names for builtin changes entry
  Use different capsule names with and without -builtin

Conflicts:
	CHANGES.current
2022-03-26 15:18:55 +00:00
William S Fulton
f2dd436a5b Rework swig_and_compile_multi_cpp makefile helper
Seems less cryptic and more maintainable to me
2022-03-26 15:16:22 +00:00
William S Fulton
3ab288dfa4 Different capsule names for builtin changes entry 2022-03-26 15:06:13 +00:00
William S Fulton
f068f2c2d6 Add Python < 3.3 support for pyabc.i
pyabc.i for abstract base classes now supports versions of Python
prior to 3.3 by using the collection module for these older versions.
Python-3.3 and later continue to use the collections.abc module.
The -py3 option no longer has any effect on the %pythonabc feature.
2022-03-23 07:58:01 +00:00
William S Fulton
2c6e7f99a6 Test -flatstaticmethod and %extend 2022-03-21 19:23:15 +00:00
Eugene Toder
f733efd3c0 Use different capsule names with and without -builtin
Types generated with and without -builtin are not compatible. Mixing
them in a common type list leads to crashes. Avoid this by using
different capsule names: "type_pointer_capsule" without -builtin and
"type_pointer_capsule_builtin" with.

See #1684
2022-03-18 13:44:54 -04:00
Jim Easterbrook
3cfc26bc30 Move low level static methods
Like the non-static methods these are no longer present when using
-builtin
2022-03-18 11:10:14 +01:00
Julien Schueller
484e5316f2 Python: Option to generate flat class methods 2022-03-18 11:10:14 +01:00
Olly Betts
c7af8eabb3 Default to running tests with Python 3
Specify PY2=1 to use Python 2.

See #1779
Closes #2235
2022-03-17 18:55:10 +13:00
William S Fulton
3159de3e9f Add support for Python variable annotations as a feature.
Both function annotations and variable annotations are turned on using the
"python:annotations" feature. Example:

  %feature("python:annotations", "c");

  struct V {
    float val;
  };

The generated code contains a variable annotation containing the C float type:

  class V(object):
      val: "float" = property(_example.V_val_get, _example.V_val_set)
      ...

Python 3.5 and earlier do not support variable annotations, so variable
annotations can be turned off with a "python:annotations:novar" feature flag.
Example turning on function annotations but not variable annotations globally:

  %feature("python:annotations", "c");
  %feature("python:annotations:novar");

or via the command line:

  -features python:annotations=c,python:annotations:novar

Closes #1951
2022-03-02 19:33:03 +00:00
William S Fulton
afc915f490 Turn on Python annotations testing again
Testing is skipped where there is no support for it, that is,
using -builtin or -fastproxy. How to add this support in needs
determining, it's not clear how to do so.
2022-02-28 19:40:35 +00:00
William S Fulton
8ce010b915 Disable Python annotations test due to incomplete support 2022-02-27 18:39:31 +00:00
William S Fulton
2072ae19c9 Python function annotations removed from -py3 option.
Python function annotations containing C/C++ types are no longer
generated when using the -py3 option. Function annotations support
has been moved to a feature to provide finer grained control.
It can be turned on globally by adding:

  %feature("python:annotations", "c");

or by using the command line argument:

  -features python:annotations=c

The implementation is designed to be expandable to support different
annotations implementations. Future implementations could implement
something like the following for generating pure Python types:

  %feature("python:annotations", "python");

or typing module types to conform to PEP-484:

  %feature("python:annotations", "typing");

Closes #1561
Issue #735
2022-02-27 10:47:50 +00:00
Seth R Johnson
f4e2a4feee Fix warning and improve description of ignore_parameter test
See https://github.com/swig/swig/pull/2205#issuecomment-1052648190
2022-02-27 18:15:39 +13:00
William S Fulton
79a1bbee8b Using declarations in inheritance hierarchy improvements.
- Improved documentation for using declarations.
- Issue new warning WARN_LANG_USING_NAME_DIFFERENT when there
  is a conflict in the target language name to be used when
  introducing a method via a using declaration. Previously
  the method was silently ignored. Issue #1840. Issue #655.
2022-02-26 12:46:06 +00:00
Olly Betts
e36e898c0a
Merge pull request #2205 from swig-fortran/extend-tests
Fix and add additional tests to test suite
2022-02-25 10:16:22 +13:00
William S Fulton
8e4868af75 More director const std::string& testing and C# leak fix
Issue #998
2022-02-13 23:00:04 +00:00
Seth R Johnson
8cf62a3325 Remove assertions from python test cases 2022-02-14 10:33:10 +13:00
Seth R Johnson
b08713f09f Add test of null shared pointers emitted from C++
This tests nulls emitted as pointers and values of shared pointers,
created from null, from references, and from default constructors.
2022-02-12 19:40:03 -05:00
Seth R Johnson
0da8a9bb44 Test ability to manipulate a daughter class from its base class wrapper
Even in the case of just creating a `DerivedClass` this test says:
```
swig/python detected a memory leak of type 'DerivedClass *', no destructor found.
```
even though the destructor is defined in the base class.
2022-02-12 19:40:03 -05:00
Seth R Johnson
fc2b90acd1 Add a "diamond" pattern to multi-impmort test
This tests whether multiple modules can correctly import
the same common module.

```
a -> d
  -> b -> c -> d*
```
2022-02-12 19:40:03 -05:00
William S Fulton
f32a20fc2f Enhance Python director_property test 2022-02-12 12:17:43 +00:00
Olly Betts
b624d17f3f Merge branch 'swig-fortran/extern-c-int'
Fixes #2199
2022-02-11 08:28:27 +13:00
Seth R Johnson
befc9bc1f0 Mark 'externc' storage for variables 2022-02-06 20:49:01 -05:00
Seth R Johnson
307c9814a0 Prevent "__dummy_0__" template methods from matching name warnings 2022-02-06 13:51:37 -05:00
Olly Betts
25f996a5c8 [python] Replace uses of assert in testsuite
We're not supposed to assert for this, as mentioned in #1488.
2022-01-30 13:38:56 +13:00
Frank Schlimbach
63452e9fc1 better handling of using directives 2022-01-30 10:55:00 +13:00
Olly Betts
f0c0816cde Update out-of-date docs re _runme3.py 2022-01-27 16:10:10 +13:00
Olly Betts
6db66bc350 Drop is_python_modern() in testcase
Python is always "modern" since e4fceee12f.
2022-01-26 12:30:44 +13:00
romin.tomasetti
8be363eae3 parser(C++11) : explicit template function support, see https://github.com/swig/swig/issues/2131 2022-01-22 15:05:23 +00:00
Olly Betts
4d3d4839b0 [python] Add multivalue_runme.py 2022-01-21 11:10:30 +13:00
William S Fulton
2272d00c1a Add Python testcase for testing flatstaticmethod syntax
For testing legacy flattened static method access for when
issue #2137 is applied.
2022-01-15 00:05:06 +00:00
William S Fulton
3aa302c08f %callback and Python class access for C++ static member functions fixes
Fix access to C++ static member functions using Python class
staticmethod syntax, such as Klass.memberfunction instead of
Klass_memberfunction, when using -fastproxy and -builtin in
combination with %callback.

The docstring containing the callback pointers were not being patched
during module initialisation.
2022-01-14 23:00:59 +00:00
William S Fulton
627f7214db [Python] Add missing Python kwargs builtin support
Accept keyword arguments accessing C++ static member functions when
using -builtin and kwargs feature and Python class staticmethod syntax.
The missing keyword argument support was only when using the
class staticmethod syntax, not when using the flat static method
syntax.
2022-01-14 23:00:42 +00:00
William S Fulton
cf8788c411 Update Python tests to not use flatstaticmethod access
Use Python class staticmethod syntax to access C++ static member functions,
such as Klass.memberfunction, instead of Klass_memberfunction.
Examples and test-suite changes in preparation for issue #2137.
2022-01-14 22:48:11 +00:00
William S Fulton
2d76057571 preproc_cpp test for testing preprocessor and C++
Move C++ comment testing into here.
See 7a9bf3307f.
2021-12-22 19:06:00 +00:00
William S Fulton
99954d6d4e Shorten testcase variable names for Scilab 6 to work 2021-11-15 22:45:56 +00:00
Julien Schueller
a2850397ba [Python] Fix overload_simple_cast test with 3.10
Closes #2044
2021-08-05 14:07:30 +02:00
William S Fulton
90cdbee6a6 Python -builtin fix wrapping constructors with varargs
Fix compilation error when using -builtin and wrapping varargs in constructors

Closes #1942
2021-03-23 23:57:49 +00:00
William S Fulton
b3bc87d551 template template parameters patch tidyup
- Document change in CHANGES file
- Minor tweaks and whitespace fixes in stype.c
- Enhance testcase
- Synchronise Java and Python runt test in testcase
2021-03-22 01:08:05 +00:00
William S Fulton
cbfc0d15b1 Fix handling of Template template parameters
Closes #1977
Fixes #1603

Squashed commit of the following:

commit 61f794184e127e4a4b46fb306b2dfea71f7cd7bb
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:20:25 2021 +0100

    added python version for second part of testcase

commit bb80e236b8a7033d1ee45e392352ec0539730db3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:10:14 2021 +0100

    reworked comment in fixed code

commit 5a94bcc481ea1c068b62a3dbc6cbc2032c9896db
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:07:34 2021 +0100

    removed new unittests; I switched to the official test cases

commit 36603f3c8dd27ee7b27d4a40804a844e1964b5aa
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 15:05:33 2021 +0100

    removed new unittests; I switched to the official test cases

commit 1f20ea00d22e6c59edb9ae69d6bb31aacab09c4b
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:39:19 2021 +0100

    adapted testcase

commit ab492794c0f26a27761b205fe1d67e2e9aa1f5b6
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 14:29:10 2021 +0100

    fixed test

commit 9b5dd0c8f9b110a3492753b466e707d7f786c909
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 13:04:06 2021 +0100

    C99 compatible comments

commit 1a89425ac8c85d68c6af1974e07573b9468d421e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 20 11:41:48 2021 +0100

    added extra checks to prevent accidental partial matches

commit 20e76f511ac139c8ea2a9a7fd89c29391579665f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:42:56 2021 +0100

    minor

commit 0e383bbb764f9a019f62b9f620f80908dead50d2
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:41:45 2021 +0100

    cleanup

commit b644767121440c77f4caeb45f672e3c698ee9d78
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:39:43 2021 +0100

    cleanup

commit 2574468c0f9352040759e680214b40ee59b03650
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:38:35 2021 +0100

    cleanup

commit 9dc7f1ed30171649e8a70b12ff4f76d93e545074
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:35:28 2021 +0100

    removed ide files

commit a442a9df460c52d4dbf7adf8e4f0c5bc5ad3b0cf
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:32:36 2021 +0100

    removed printf

commit da4c6e91e3b70e72e89cf09dfabfef7416274637
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:29:02 2021 +0100

    possible fix found

commit 6fad8d40e36195be422d5822e6f49d610e3ab693
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Thu Mar 18 21:01:11 2021 +0100

    found difference between good/bad case... next: analyze why replacement did not work here...

commit 72a7693340358d2067e63c5489191917ccb818dd
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:43:08 2021 +0100

    ideintified location where the template-template type is inserted in the final type (with the missing specialization).

commit 1b53312c07ab0696d9cade144bdbad1c84ebf6a3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:28:19 2021 +0100

    more notes (to be reverted)

commit a9a0b589389784e0e95dc6f9edd27c78a16b481d
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 22:19:16 2021 +0100

    some experiments (to be reverted)

commit 0e7a24bbd5944d6e4f5c96ffd03003465f6d80f5
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Wed Mar 17 21:46:20 2021 +0100

    added some notes

commit 2f77911a12a38735cadeb93223981f3a6d9e7450
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 22:01:01 2021 +0100

    comment changed

commit 2cb7213b06f9b912c0ba56350ec6c318edba1ffb
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:55:47 2021 +0100

    renamed example template parameters to easily distinguish them.

commit ff457d73977e05adf84b095bcfa1dccd21203c48
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 21:21:10 2021 +0100

    added reset parser functionality (required for unittests, to reset parser)

commit 617bbde3b4b3d9dd16d3a2d85041fc78a87ae81f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Tue Mar 16 20:47:41 2021 +0100

    adjusted test for simple templates

commit beb7e7f77cedd4ecfa4165534781d417710aff7e
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Mon Mar 15 07:41:17 2021 +0100

    added note how it should be...

commit 7b3328431ce41f7ec05657c69d3cb1a886cb8437
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 17:07:24 2021 +0100

    found a place which is maybe problematic for the template_template problem (#1603)

commit 46c2443d15a6288318723b7e730687791475cf7b
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 16:11:56 2021 +0100

    unitests: reset parser for each testcase

commit b3a0f1516ffdbf9f0fbb2d8362e2375fd1893c3f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 15:30:47 2021 +0100

    first experiment with templates

commit 32a11c6c77b840f11b9e926edd465e6a7108267f
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:31:17 2021 +0100

    wip

commit 37b805ba6eaadb4a34a929204d539f555f8313be
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:21:05 2021 +0100

    integrated unittests in ctest

commit 79f7bee168ecfbd2f2f5feeb9ca43fb7113bc2a4
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:18:26 2021 +0100

    wip: new test created; problem: not in c++ mode

commit 345d503d557d67fa431f528e637bac5816f50ab1
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:08:09 2021 +0100

    cleanup test code

commit 0a26adec10435af36bfad4e1f6a073460c63fbc6
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 14:05:24 2021 +0100

    some more tests (first steps with c++ code)

commit 6f628e0fa9e2659f5a7ca08b9954e81d4cd4f012
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sun Mar 14 12:56:41 2021 +0100

    experiments

commit c4a13bf3e12cd83886cbc54e32194bf916a643d3
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 18:18:01 2021 +0100

    first experiment

commit 7d265861052f205d48b1ccec8ab0fe053de19858
Author: goto40 <pierre.bayerl@googlemail.com>
Date:   Sat Mar 13 17:23:13 2021 +0100

    setup catch2 framework (w/o tests)
2021-03-22 01:02:42 +00:00
Zackery Spytz
bcfa927298 Fix typos in attribute2ref() in Lib/typemaps/attribute.swg
AccessorName was being used instead of AttributeName.

Closes #1872.
2021-02-09 09:21:14 -07:00
William S Fulton
638ca8152d complex can now be used as an identifier
Remove final vestiges of 'complex' keyword.

Closes #252
2020-10-10 16:07:55 +01:00
William S Fulton
71a13e60de Quieten ccomplextest 2020-10-10 15:21:13 +01:00
William S Fulton
f318bb8286 Add missing clean targets
template_typedef_cplx2 files are generated by the template_typedef_import.multicpptest
but can also be cleaned by the template_typedef_cplx2.cpptest target.
2020-10-10 15:02:26 +01:00
William S Fulton
fd592fdc3b Split C complex.h from C++ complex testing 2020-10-10 15:01:29 +01:00
William S Fulton
2cbf7d725a Remove Remove runtime test for unsupported complex or _Complex by itself 2020-10-10 14:53:46 +01:00
William S Fulton
4f184500d7 Merge commit '8245277ad3' into c99-complex
* commit '8245277ad3':
  Remove test for unsupported complex or _Complex by itself
  More C99 complex fixes, plus Python tests
  Restore _Complex as standalone type
  Small corrections for handling C99 _Complex
  Properly handle C99 complex types even in C++ mode

Conflicts:
	Examples/test-suite/python/complextest_runme.py
2020-10-10 14:53:33 +01:00
William S Fulton
b456449940 Update python_pybuffer_runme.py syntax for working under both python 2 and 3 2020-10-07 22:41:04 +01:00
William S Fulton
4d5f4bcd33 Merge branch 'PyBuffer_Release-pybuffer'
* PyBuffer_Release-pybuffer:
  Add tests.
  Fix the error handling for the PyObject_GetBuffer() calls in pybuffer.i
2020-10-07 22:37:17 +01:00