Commit graph

2,651 commits

Author SHA1 Message Date
William S Fulton
87bede9a99 Return to Python builtin tp_new initialization in init function. 2016-10-15 22:43:42 +01:00
William S Fulton
d29fc38d1c Fix Python builtin binaryfunc slots when using -O
Code did not compile - recent regression due to 848628
2016-10-14 07:30:44 +01:00
William S Fulton
08688d7d9d Add support for "ret" typemap where missing and improve documentation on it. 2016-09-29 08:07:26 +01:00
ahmed-usman
2d871655e3 Update xml.cxx to return typenames (#777)
Typenames were being returned wrong, so add a condition to handle templateparms correctly.
2016-09-27 15:15:47 +13:00
Li Shengqiu
bac85d5b1a [Go] Fix argument names in inherited functions #795 (#797)
* [Go] Fix argument names in inherited functions #795

This commit fixes a wrong argument name replacement in the inherited functions as well as a memory leak.

* Add testcase for #795

* Move variable_replacement testcase into common

* Move variable_replacement testcase into common
2016-09-27 15:08:47 +13:00
William S Fulton
848628ae91 More flexible python builtin slots
The closure names used for builtin slots are mangled with their functype so
 that overloaded C++ method names can be used for multiple slots.
For example:
%feature("python:slot", "mp_subscript", functype="binaryfunc") SimpleArray::__getitem__;
%feature("python:slot", "sq_item", functype="ssizeargfunc") SimpleArray::__getitem__(Py_ssize_t n);
will generate closures:
  SWIGPY_SSIZEARGFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___ssizeargfunc_closure */
  SWIGPY_BINARYFUNC_CLOSURE(_wrap_SimpleArray___getitem__) /* defines _wrap_SimpleArray___getitem___binaryfunc_closure */
2016-09-25 14:15:38 +01:00
Olly Betts
1adfe2f537 [PHP] Fix code generated for feature("director:except")
Previously the return value of call_user_function() was ignored and we
checked an uninitialised value instead.  Fixes #627.  Based on patch
from Sergey Seroshtan.
2016-09-25 14:42:04 +13:00
William S Fulton
0769e9b727 Fix iterators for containers of NULL pointers (or Python None) when using -builtin.
Previously iteration would stop at the first element that had a NULL pointer value.
2016-09-17 17:53:48 +01:00
Olly Betts
26bbc96d58 Arrange to return after calling zend_throw_exception()
Fixes github issue#240.
2016-09-16 17:54:02 +12:00
Olly Betts
849f157efa [Python] Fix import in frozen app for Python 2.6 (#784)
Fix import handling for Python 2.6 to work in a frozen application.
Fixes #145, reported by Thomas Kluyver.
2016-09-12 08:11:47 +12:00
William S Fulton
5b7c08c214 Make Python builtin types hashable by default
Default hash is the underlying C/C++ pointer.
This matches up with testing for equivalence (Py_EQ in SwigPyObject_richcompare)
which compares the pointers.
2016-08-23 19:06:36 +01:00
William S Fulton
1cef6b7440 Merge branch 'builtin-tweaks'
* builtin-tweaks:
  Python builtin minor tweaks
  Cosmetic code formatting corrections
  Further additional Python builtin slots as features for user customization
  Add additional Python builtin slots as features for user customization
  Correct notes on customising Python builtin comparison operators
  Set tp_new statically rather than during initialisation
  Customize slots tp_basicsize tp_methods tp_getset
  Additional Python builtin slot overrides and slightly better formatted Python generated code
  Add Python builtin tp_dealloc override test
  Python getSlot() refactor
  Add Python builtin closure method in comment
  Update Python docs on builtin slots
  Python builtin hashfunc closure fix
2016-08-22 19:37:10 +01:00
William S Fulton
ae32fb4f9a Python builtin minor tweaks
Remove internal Python struct names from generated code
Cosmetic code formatting
2016-08-22 19:28:52 +01:00
William S Fulton
ad452edf3e Cosmetic code formatting corrections 2016-08-22 08:48:04 +01:00
William S Fulton
bf4174d121 Further additional Python builtin slots as features for user customization
Added:
- tp_flags
- was_sq_slice
- was_sq_ass_slice
2016-08-22 08:39:24 +01:00
William S Fulton
e5a09c4141 Add additional Python builtin slots as features for user customization
Added:
- tp_is_gc
- tp_bases
- tp_mro
- tp_cache
- tp_subclasses
- tp_weaklist
- tp_del
- tp_allocs
- tp_frees
- tp_maxalloc
- tp_prev
- tp_next
2016-08-22 07:51:42 +01:00
William S Fulton
3b6f4af15c Set tp_new statically rather than during initialisation 2016-08-21 14:29:27 +01:00
William S Fulton
3744c45082 Customize slots tp_basicsize tp_methods tp_getset 2016-08-19 23:46:50 +01:00
William S Fulton
239785ce7d Additional Python builtin slot overrides and slightly better formatted Python generated code
The following slots can now be overidden by users if they know what they
are doing:
- tp_dictoffset
- tp_init
- tp_new
- tp_as_number
- tp_as_sequence
- tp_as_mapping
- tp_as_buffer
2016-08-19 23:16:32 +01:00
William S Fulton
67ece1d2bf Python getSlot() refactor
getSlot() now takes a default that can override "0" default - simpler
code and for future commits to override some currently non-overridable
slots.
2016-08-19 08:43:40 +01:00
William S Fulton
a3fc743f32 Add Python builtin closure method in comment
For less mystifying code and easier code searching
2016-08-18 08:41:07 +01:00
Olly Betts
a950d1309b [xml] Fix how the output filename is built
Avoid problems when it contains the embedded strings ".c", ".cpp" or ".cxx".
Fixes #540 reported by djack42.
2016-08-05 11:52:35 +12:00
Simon Marchetto
d0a45be1eb scilab: fix issue #746 2016-07-29 16:56:30 +02:00
Simon Marchetto
95a5def328 scilab: fix issue #755 2016-07-29 11:52:26 +02:00
William S Fulton
b24e970a28 Merge branch 'wkalinin-nested-ignore-fix'
* wkalinin-nested-ignore-fix:
  renamed test module, in accordance with other tests
  function body fixed
  added foo() definition to satisfy some test linking fails
  func() renamed to foo() for 'go'
  fixed test-suite/nested_ignore.i
  test for #662
  fix for nested ignored types

Closes #662
2016-06-26 00:33:19 +01:00
William S Fulton
2da7e066b3 Merge branch 'avalluri-leaks'
* avalluri-leaks:
  whitespace fix
  memory leak improvements - delete at end of scope
  CCache: Fix typo in null check
  CCache: Fix memory/file descriptor leaks
  scilab.cxx: Fix memory leaks
  Fix leaked file descriptor
  Lua: Fix possible memory leaks
  go.cxx: Fix use of a freed variable

Closes #710
Closes #712
Closes #713
Closes #715
Closes #716
2016-06-26 00:16:30 +01:00
William S Fulton
7ec7cc63da memory leak improvements - delete at end of scope 2016-06-26 00:06:01 +01:00
Alec Cooper
4f1c491090 Fixing implicitconv handling for fastdispatch and castmode 2016-06-23 08:06:14 -04:00
William S Fulton
38cda92938 smartptr inheritance fix when using templates and typedefs
Fixes SF bug 3333549 - %shared_ptr fixes when the type is a template using
template parameters that are typedef'd to another type.

Also fixes python -O optimization where the smart pointer conversion to the
base class needs to work because of the virtual methods that have been
optimized away.
2016-06-21 07:00:56 +01:00
Amarnath Valluri
9b371b48d1 scilab.cxx: Fix memory leaks
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-06-16 15:59:21 +03:00
Amarnath Valluri
08d5e19e6e Lua: Fix possible memory leaks
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-06-16 15:51:50 +03:00
Amarnath Valluri
11b971f405 go.cxx: Fix use of a freed variable
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-06-16 15:47:12 +03:00
William S Fulton
9b73cd036f Avoid polluting global python namespace with version_info symbol 2016-06-07 08:12:48 +01:00
William S Fulton
81adedd7dd Python: Do not import all of sys when using -relativeimport 2016-06-06 22:20:07 +01:00
Mike Romberg
d55151ac70 > to >= 2016-06-06 13:26:55 -06:00
Mike Romberg
9ce4b58df4 Make the check for python3 -relative does python runtime check. 2016-06-06 01:28:40 -06:00
Mike Romberg
1495313e53 fix for new split module test cases. 2016-06-02 23:56:15 -06:00
William S Fulton
b9ca9f5efc Smart pointer to %ignored class doesn't expose inherited methods fix.
Regression introduced in swig-3.0.9 by 3efdbc8
Closes #690
2016-05-31 22:10:37 +01:00
William S Fulton
55fe53dc3f Fix SWIG overloading warning display for R and allegrocl
Only half the warning would have been displayed due to missing if statement brackets.
Fixes gcc-6 warnings
2016-05-28 20:09:02 +01:00
William S Fulton
bee6964b48 Compile warning fix 2016-05-28 15:13:23 +01:00
William S Fulton
a91d1b5a42 Remove unused kwnames generated variable in Ruby wrappers
This seems to be from some left over Python kwargs / unfinished kwargs support
2016-05-28 00:45:24 +01:00
William S Fulton
7ead141aa9 Fix unused variable warning in Perl wrappers 2016-05-28 00:45:24 +01:00
William S Fulton
d01efd82e1 Merge branch 'mromberg-implpkg'
* mromberg-implpkg:
  Minor edits to Python implicit namespace package docs
  use %inline for test
  use relative import for -builtin and python2
  Python3 removes support for relative imports
  Document implicit namespace packages for python
  disable namespace package build
  Attempt to calm the testing gods...
  use whatever name winders uses for .so files.
  Examples (and tests) for python namespace packages
  disable namespace package build
  spelling
  Attempt to calm the testing gods...
  use whatever name winders uses for .so files.
  Don't run example for old pythons
  Examples (and tests) for python namespace packages
  use importlib to load C extension modules for python 2.7 and newer
2016-05-24 22:48:37 +01:00
Mike Romberg
10d71ca01a use relative import for -builtin and python2 2016-05-24 22:46:35 +01:00
Vladimir Kalinin
0145a07cc3 fix for nested ignored types 2016-05-18 18:07:04 +03:00
William S Fulton
70f5a9ceed Merge branch 'tamuratak-master'
* tamuratak-master:
  Revert introduction of minor memory leak in Ruby wrappers
  ruby: use nodeType attribute to determine whether functions are constructors.       get return type each time.
2016-05-17 20:05:20 +01:00
William S Fulton
1330337491 Revert introduction of minor memory leak in Ruby wrappers 2016-05-17 20:04:24 +01:00
William S Fulton
38f8fd811c Merge branch 'ruby-module-docstring'
* ruby-module-docstring:
  Ruby module docstring avoid memory leak
  Ruby add support for docstring option in %module()
2016-05-17 19:04:20 +01:00
William S Fulton
5e6ab1d61d Merge branch 'ejulien-python_operator_overload_test_suite'
* ejulien-python_operator_overload_test_suite:
  Add __str__ to operator_overload testcase for python builtin
  Python operator_overload runtime testcase cleanup
  Work around a limitation of the Python binding generator related to the += family of operators.
  Fix Python 3 division member operator when -builtin is not used.
  Fix class member division operator.
  Remove the PY3BUILTIN switch as its behavior can be achieved with the existing SWIG_FEATURES=-builtin switch.
  Implement the operator overload test suite for Python.

Conflicts:
	Examples/test-suite/operator_overload.i
2016-05-05 23:01:35 +01:00
William S Fulton
3efdbc8f2e Don't issue unnecessary base class ignored message
Don't warn about base class being ignored when the derived class is
itself ignored.

Closes #669
2016-05-02 22:50:09 +01:00