Commit graph

20,800 commits

Author SHA1 Message Date
William S Fulton
23ce449ea5 Remove Python -new_vwm
Use the -newvwm alias name instead.
2018-10-24 20:04:31 +01:00
William S Fulton
39b48b8689 Remove Python -oldrepr option
This option controlled the __repr__ proxy class method.

Also removes:
  -old_repr
  -oldrepr
  -new_repr
  -newrepr

Note: -newrepr was and remains on by default. When -oldrepr/-old_repr
option resulted in code that did not run.
2018-10-24 20:04:31 +01:00
William S Fulton
1274c1abfc Remove Python -classptr option
This option was for backwards compatibility with very old versions of
SWIG that generated a shadow 'XPtr' class derived from proxy class X.

If anyone is still using these, they are best off using the actual proxy
class, or otherwise add them in manually using %pythoncode.

Issue #1340.
2018-10-24 20:04:31 +01:00
William S Fulton
0bd7134ffc Merge branch 'hakonhagland-doc_fix'
* hakonhagland-doc_fix:
  Documentation refers to wrong chapter.
2018-10-24 19:56:48 +01:00
William S Fulton
7375d4575a Typemap %apply docs clarification 2018-10-24 19:53:31 +01:00
William S Fulton
411c17f15d Remove Python 3 OSX Travis testing.
Pouring gcc-8.2.0.high_sierra.bottle.1.tar.gz
Error: The  step did not complete successfully

Above error needs fixing
2018-10-24 08:13:21 +01:00
William S Fulton
dc5885e22d Documentation correction about -fastproxy 2018-10-22 18:43:35 +01:00
William S Fulton
cd4732f3e3 Add changes entry about the reduced number of command line options 2018-10-22 18:43:32 +01:00
William S Fulton
cd8fc0a025 Remove Python -aliasobj0 option
This option was originally added to help users switch to using
-fastunpack so that typemaps using obj0 did not need changing by
providing an alias for swig_obj[0] to obj0. The correct solution was
always to replace obj0 with $self in the typemap. This is now mandatory.
However, the -nofastunpack option can still be used to circumvent using
the mandatory typemap change.
2018-10-22 08:19:50 +01:00
William S Fulton
04c5061698 Hardwire Python -fastunpack be on by default
The -nofastunpack option has been left in as there isn't much code
simplification in removing the nofastunpack code. This is because the
nofastunpack code is still sometimes needed (eg varags and overloaded
functions).
2018-10-22 08:19:50 +01:00
William S Fulton
3917225fdb Cosmetic Python error message improvement 2018-10-22 08:19:50 +01:00
William S Fulton
a1f40568d6 Remove non-const char * usage where the Python API now supports it
Python fixed many APIs to use const char * instead of char * at around
Python 2.4. As we support 2.7 and later, we can now remove the non-const
string usage.
Types changed:
  PyArg_ParseTuple
  PyArg_ParseTupleAndKeywords
  PyArg_UnpackTuple
  PyDict_SetItemString
  PyMethodDef
  PyModuleDef
  SWIG_Python_UnpackTuple
  SWIG_Python_str_FromChar
  SWIG_addvarlink
  swig_const_info
2018-10-22 08:19:50 +01:00
William S Fulton
18f433d862 Tcl swig_const_info - use const char * 2018-10-22 08:19:50 +01:00
William S Fulton
de26ebbad1 Remove Python -safecstrings option.
This option, if used, has not had any effect on Python 3 code since commit a863d3 9 years ago.
I think we can assume that it is not needed for Python 3.
Running the examples and test-suite (Python 2) doesn't change the code
paths with and without -safecstrings because only SWIG_OLDOBJ and SWIG_NEWOBJ
are used in the typemaps and the following code is thus unaltered by -safecstrings
(which sets SWIG_PYTHON_SAFE_CSTRINGS):

%#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
  if (*alloc != SWIG_OLDOBJ)
%#else
  if (*alloc == SWIG_NEWOBJ)
%#endif
  {
    *cptr = %new_copy_array(cstr, len + 1, char);
    *alloc = SWIG_NEWOBJ;
printf("safe strings: %s\n", *cptr ? *cptr : "NULLSTRING");
  } else {
    *cptr = cstr;
    *alloc = SWIG_OLDOBJ;
  }

Note: nosafecstrings was also the default and -O didn't actually change this.
2018-10-22 08:19:50 +01:00
William S Fulton
b2aa01f492 Python options simplification: Remove -buildnone, -nobuildnone
A custom implementation for Py_None was implemented in SWIG_Py_None().
This was used by default on Windows only. It isn't clear why this
was done just for Windows. Now Py_None is the real Py_None on all
operating systems.
2018-10-22 08:19:50 +01:00
William S Fulton
d84d26832f Hardwire Python -fastquery option to be always on
The Python dictionary cache used for SWIG types lookup is now always on.
2018-10-22 08:19:50 +01:00
William S Fulton
350396fcae Hardwire Python -fastinit option to be always on
This option runs the equivalent init code in Python C code instead of pure Python code.
The init code adds the C++ pointer into the 'this' variable.
If the variable already exists, it appends it. This
seems to only happen in directors and multiple inheritance, see
PyMulti in director_basic_runme.py.
2018-10-22 08:19:50 +01:00
William S Fulton
7d6bb6cd44 Add missing run of the functors testcase 2018-10-22 08:19:50 +01:00
Håkon Hægland
c97a455c34 Documentation refers to wrong chapter.
Chapter 10, first section, refers to Chapter 3 (Getting started on
Windows) but should presumably be Chapter 5 (SWIG Basics).
2018-10-17 13:00:04 +02:00
William S Fulton
fe155d7516 Disable Javascript Node 10 testing
Upgrade from v10.11.0 to v10.12.0 on Travis started breaking the builds
2018-10-12 18:33:19 +01:00
William S Fulton
edfbbab8e2 Merge branch 'python-options-rationalise'
* python-options-rationalise:
  Hard-wire -noproxydel on
  Hard-wire -modern and -modernargs on
  Drop support for Python classic classes
2018-10-12 07:13:12 +01:00
Olly Betts
4a48e59dc6 Hard-wire -noproxydel on
We only still default to generate a no-op __del__ method for theoretical
compatibility with old code, and 4.0.0 is a good time to make a cut-off
should such code really still exist.

On the flip-side, the presence of a __del__ method seems to be able to
prevent garbage collection from kicking in (see #1215), so it's
definitely desirable to get rid of it when there's nothing for it to do.

 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
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
e3a55562cc
Merge pull request #1333 from jschueller/patch-1
[Python] Fix -Wstringop-overflow warning
2018-10-10 00:04:27 +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
967776189e Add support for non-default compare template argument in std::map wrappers - Javascript 2018-10-09 22:42:49 +01:00
William S Fulton
c8fc6a0322 Fix guile std::map bug in out typemap 2018-10-09 19:46:27 +01:00
William S Fulton
ca287ae13b Add support for non-default compare template argument in std::map wrappers 2018-10-09 19:44:00 +01:00
William S Fulton
220a735ec5 Update php test 2018-10-09 19:37:07 +01:00
William S Fulton
8ddf24881a Merge branch 'vadz-java-map-comp'
* vadz-java-map-comp:
  Add support for std::map<> comparator template argument for Java

Conflicts:
	CHANGES.current
2018-10-09 07:09:06 +01:00
William S Fulton
51f1478df7 Improve typemaps documentation for %apply and delete.
Make %apply and %clear section clearer (hopefully).
2018-10-05 20:45:52 +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
Julien Schueller
c0c2d90497
[Python] Fix -Wstringop-overflow warning
fixes #1332
2018-10-01 09:31:42 +02:00
William S Fulton
142d4062df Fix invalid free in SWIG_Python_AddErrMesg
Closes #1331
2018-09-28 07:08:12 +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
3872890c1c Add changes file entry for Python hash table implementation 2018-09-24 07:07:25 +01:00
William S Fulton
d30effd886 Python builtin closure minor tweaks 2018-09-23 19:20:22 +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
603285ecb6 Python std::unordered_map improvements
Pick up various bug fixes and improvements from the std::map
implementation.
2018-09-23 19:09:59 +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