Commit graph

3,951 commits

Author SHA1 Message Date
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
Julien Schueller
9ed60ac7a0 Drop deprecated PyEval_CallObject method
see https://docs.python.org/3.9/whatsnew/3.9.html
2020-10-15 08:43:21 +02:00
William S Fulton
4b5baf0a60 0.0 float warning fix 2020-10-10 15:02:26 +01:00
William S Fulton
9a2513bf85 Javascript v8 C complex wrappers fix 2020-10-10 14:53:46 +01:00
William S Fulton
57957787b7 Convert C++ comment to C comment 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
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
William S Fulton
c1b004f4fa Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.

For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.

For example:

  %typemap(csinterfacemodifiers) X "internal interface"

Closes #1874
2020-09-25 18:54:25 +01:00
Gareth Francis
beb1d8498d Fix C# wchar_t* csvarout to be same as csout 2020-09-05 17:03:34 +01:00
William S Fulton
b018c32f9d Fix crashes in swig_connect_director during director class construction.
Occurs when using the director class from multiple threads - a race condition
initialising block scope static variables.

Block scope static variables are guaranteed to be thread safe in C++11,
so the fix is guaranteed when using C++11. However, most modern compilers
also fix it when using C++03/C++98.

Closes #1862
2020-08-28 18:23:47 +01:00
William S Fulton
9c50887daa Python 3.9 support
Remove PyEval_InitThreads() call for Python 3.7 and later as Python calls
it automatically now. This removes a deprecation warning when using Python 3.9.

https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
2020-08-27 19:37:26 +01:00
William S Fulton
bfddc50a6a Add C# support for void *VOID_INT_PTR member variables
Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
2020-08-13 16:06:48 +01:00
Chris Burr
eafe1e2daa
Use Py_TYPE in SwigPyBuiltin_SetMetaType 2020-07-28 08:11:02 +02:00
Chris Burr
917110212e
PyTypeObject::ob_base isn't available in PyPy 2020-07-17 12:15:54 +02:00
Leo Singer
511df0e642 More C99 complex fixes, plus Python tests 2020-06-24 20:21:47 -04:00
Leo Singer
07b4b274e5 Restore _Complex as standalone type 2020-06-24 20:21:47 -04:00
Leo Singer
1adc7dac5d Small corrections for handling C99 _Complex 2020-06-24 20:21:47 -04:00
Leo Singer
13260f95b0 Properly handle C99 complex types even in C++ mode
Use the `_Complex` keyword rather than the `complex` macro.

Fixes #1487.
2020-06-24 20:21:47 -04:00
Zackery Spytz
772dfd5dcb Fix the error handling for the PyObject_GetBuffer() calls in pybuffer.i
Closes #1640.
2020-06-07 17:47:11 -06:00
William S Fulton
938c3bbb54 Merge branch 'fix-1199'
* fix-1199:
  fix #1199
2020-06-07 10:29:55 +01:00
William S Fulton
a6dc8821c2 Merge branch 'andreas-schwab-master'
* andreas-schwab-master:
  Ruby wstring - only include endian.h on linux
2020-06-06 08:42:17 +01:00
Andreas Schwab
58ffbe616f Ruby wstring - only include endian.h on linux
This file is not always available on other systems.
See #1801
2020-06-06 08:39:47 +01:00
William S Fulton
85f2378b84 Merge branch 'r-script-fixes'
* r-script-fixes:
  Fix further missing semicolons in R code.
  fixed some missing semicolons. Each one caused a compile error in generated code
2020-06-02 18:11:12 +01:00
Karl Wette
d73ef20475 octrun.swg: ensure type_id() is set correctly 2020-05-31 22:11:51 +10:00
Karl Wette
d11e29615d Octave: use pre-compiled headers to speed up test suite, if supported 2020-05-31 22:11:51 +10:00
Karl Wette
26423d06b3 octruntime.swg: do not use atexit() to quit Octave
- This reverts commit 931656bcbe
- Since atexit() does not pass along the desired exit status,
  __swig_atexit__() always exits with status zero, regardless
  of whether Octave completed successfully or raised an error.
- This means the success/failure of Octave scripts which load
  SWIG modules cannot be determined by other programs, which
  makes them unusable.
- Instead, provide a Octave function swig_exit() which calls
  ::_Exit() with a given exit status. This way at least a
  clean exit from Octave can be guaranteed for future versions
  if the seg-fault problem is not fixed.
2020-05-31 06:43:15 +10:00
Karl Wette
30132bf777 octrun.swg: remove octave_value type-id from octave_swig_bound_func
- The {DECLARE|DEFINE}_OV_TYPEID_FUNCTIONS_AND_DATA declarations
  attached to this class cause a seg-fault in the module_load
  Octave example. Removing these declarations fixes the seg-fault.
- While cause of seg-fault is unknown, note that (in Octave 5.1.0)
  the declaration of octave_function, which is the base class for
  octave_swig_bound_func, does not use these declarations. So it's
  possible they simply are not required for this type of subclass.
2020-05-31 06:43:15 +10:00
Marcel Steinbeck
3c9dd44ff4 D: Replace deprecated imports (package std.c). Fixes #1593 2020-05-30 16:28:48 +01:00
William S Fulton
02e967d05d
Merge pull request #1716 from ZackerySpytz/Python-utf8-cache
Use PyUnicode_AsUTF8() for Python >= 3.3
2020-05-29 23:56:10 +01:00
khoran
d58041606e fixed some missing semicolons. Each one caused a compile error in generated code 2020-03-25 11:01:12 -07:00
William S Fulton
aad43031a4 Merge branch 'ryannevell-master'
* ryannevell-master:
  Clean up test cases
  Fix unwrapping of LUA lightuserdata type. Add test case.
2020-02-18 22:07:05 +00:00
William S Fulton
4ce77ffb77 Ruby - catch exceptions by const reference 2020-02-18 22:06:20 +00:00
William S Fulton
c08e0d19f9 Merge branch 'catch-value'
* catch-value:
  Catch exceptions by reference rather than by value.
2020-02-18 22:00:45 +00:00
Ryan Nevell
33c59614fc Fix unwrapping of LUA lightuserdata type. Add test case. 2020-02-17 09:16:24 -08:00
Daniel Mach
70f6ee9656 Catch exceptions by reference rather than by value.
Fixes -Wcatch-value gcc warnings.
2020-02-14 12:58:49 +01:00
William S Fulton
6cec69ef7b Remove an unnecessary shared_ptr reference count increment in Ruby wrappers
When wrapping STL containers, remove a shared_ptr reference count
increment when an upcast is needed when checking type conversion
in traits_check::check.
2020-02-13 19:48:30 +00:00
William S Fulton
67a38589a8 Minor code refactor in Python traits_asptr::asptr 2020-02-13 19:32:13 +00:00
William S Fulton
339d427910 Merge branch 'master-fix-vector-shared_ptr'
* master-fix-vector-shared_ptr:
  fixing memleak of shared_ptr objects in python with creating a [wrapped] vector<shared_ptr<Foo>> from a list of shared_ptr<Bar> where Bar is derived from Foo.
2020-02-13 19:21:12 +00:00
William S Fulton
94b4c7dc21 Better error checking when setting 'this' in Python
If python_append.i is modified to use:
__slots__ = []
instead of
__slots__ = ["this"]
then this additional error checking prevents a crash and shows a stack trace and error:
  AttributeError: 'ForSlots' object has no attribute 'this'

Related to issue #1674
2020-02-06 07:27:08 +00:00
William S Fulton
a01e8474f6 Fixing setting this in Python when using __slots__
Don't attempt to use the class's __dict__ for setting 'this' when
a user has extended a class with:
    __slots__ = ['this'].
Was segfaulting. Now we fall back to a simple PyObject_SetAttr if the
usual approach to setting 'this' in __dict__ does not work.

Closes #1673 Closes #1674
2020-02-06 07:08:16 +00:00
Viktor Gal
7d2dbe3670 fix #1199 2020-02-01 11:25:30 +01:00
Zackery Spytz
f6d97d2338 Use PyUnicode_AsUTF8() for Python >= 3.3 2020-01-31 23:48:32 -07:00
William S Fulton
ebc324dfd5 Merge branch 'ruby-autoptr'
* ruby-autoptr:
  Extend std::auto_ptr<> support to Ruby
2020-01-31 19:26:19 +00:00
William S Fulton
10cbc9481f Merge branch 'Python-coverity'
* Python-coverity:
  Fix possible refleaks.
  Check Py{Bytes,String}_AsStringAndSize() for failure
2020-01-31 19:14:47 +00:00
William S Fulton
a0d4218543 Minor refactor of R error handling code 2020-01-31 08:58:09 +00:00
Arnaud Barré
3fa5c8c652 Fix R memory leak on exception
There is a possible memory leak in case the SWIG_exception_fail macro
is called. The problem is related to its definition that call the
function Rf_warning. This function (as well as Rf_error) involves
a longjmp over C++ destructors on the stack. Thus, all the objects
allocated on the heap are not freed.

Closes #914
2020-01-30 20:43:39 +00:00
Zackery Spytz
58e409dd2b Fix possible refleaks. 2020-01-29 10:00:22 -07:00
Vadim Zeitlin
7cc94808b6 Extend std::auto_ptr<> support to Ruby
This is trivial as exactly the same typemap as for Python can be used
for Ruby too, all the differenced are abstracted by the unified typemap
library.
2020-01-17 15:09:17 +01:00
Julien Schueller
96c6bf4cc2 Fix unused-parameter warning in pycontainer.swg 2020-01-17 11:09:57 +01:00
William S Fulton
5ce839932c Merge branch 'OCaml-caml_named_value-const'
* OCaml-caml_named_value-const:
  [OCaml] Fix compilation errors with OCaml 4.09.0
2020-01-13 19:46:29 +00:00