summaryrefslogtreecommitdiff
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* Support std::array in Golang (#2045)ERROR2022-01-041-0/+43
| | | | | Support std::array in Golang Closes #2045
* [php] Use SWIG_TypeCheckStruct to check typesOlly Betts2021-12-192-38/+18
| | | | | | | We have the swig_type_info available and SWIG_TypeCheckStruct is more efficient because it uses a pointer comparison instead of the string comparison SWIG_TypeCheck uses (this change speeds up `make check-php-test-suite` by about 10%).
* [PHP] Add new PHP 8.1 keywordOlly Betts2021-12-181-0/+9
| | | | | | Add PHP keyword 'readonly' (added in 8.1) to the list SWIG knows to automatically rename. This keyword is special in that PHP allows it to be used as a function (or method) name.
* Improve naming of zend_class_entry structsOlly Betts2021-12-171-6/+6
| | | | | | | Previously the zend_class_entry for Foo was named SWIGTYPE_Foo_ce, but this can collide in some cases - e.g. if there's a class named p_Foo then its zend_class entry will be SWIGTYPE_p_Foo_ce, but that's the same as the swig_type_info for a class named p_Foo_ce.
* Improve generated object handlersOlly Betts2021-12-171-0/+21
| | | | | | | | | | Do more initialisation at module load time. Use a shared set of handlers for cases when the C/C++ object is destroyed with free(). Most of the code in the free_obj and create_object handlers is the same for every wrapped class so factor that out into common functions.
* Rename php_fetch_object with swig_ prefixOlly Betts2021-12-171-3/+3
| | | | | We shouldn't be using symbols starting `php` as that risks collisions with future symbols defined by PHP.
* Tweak source whitespace to match SWIG conventionsOlly Betts2021-12-151-0/+1
|
* [lua] Fix maybe-uninitialized warning in generated codetytan6522021-12-151-1/+1
|
* [php] Remove redundant in typemap for boolOlly Betts2021-12-131-1/+0
| | | | | | This typemap which would wrap C++ bool as PHP int is later overridden by another which wraps it as PHP bool. The current result is what we want so just remove the redundant one.
* [php] Fix two incorrect PHP 8 conditionalsOlly Betts2021-12-082-5/+5
| | | | | | | | The correct macro to test is PHP_MAJOR_VERSION so these two PHP 8 cases weren't ever used, which hid that the PHP8 version of the code was broken in one of them. Highlighted in #2113.
* Merge pull request #2116 from vstinner/python311William S Fulton2021-12-071-0/+4
|\ | | | | Add Python 3.11 support: use Py_SET_TYPE()
| * Add Python 3.11 support: use Py_SET_TYPE()Victor Stinner2021-12-061-0/+4
| | | | | | | | | | | | | | | | | | On Python 3.9 and newer, SwigPyBuiltin_SetMetaType() now calls Py_SET_TYPE(). Py_TYPE() can no longer be usd as an l-value on Python 3.11: * https://docs.python.org/dev/c-api/structures.html#c.Py_SET_TYPE * https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes
* | Additional changes due to name changes in octave-6 * is_map to isstruct, ↵Robert Fries2021-12-051-0/+18
| | | | | | | | is_object to isobject
* | Octave module lets examples and tests work with Octave-6 * Try-catch ↵Robert Fries2021-12-053-9/+83
| | | | | | | | replacement for check of error_state * Add execute method in addition to call * Replace oct_mach_info with octave::mach_info * Call from interpreter: global_varval global_assign * Assign a global name requires locating the stack which requires interpreter to tree evaluator to callStack * Do not use discard_error_messages or discard_warning_messages
* | Allow swig wrapped modules to compile with -BsymbolicRobert Fries2021-12-052-0/+10
|/
* Merge branch 'fix-crash-2101'William S Fulton2021-12-022-216/+233
|\ | | | | | | | | | | * fix-crash-2101: Added extern "C" block that was removed in previous commit. Fixed crashes when using embedded Python interpreters.
| * Added extern "C" block that was removed in previous commit.John Senneker2021-12-011-0/+8
| |
| * Fixed crashes when using embedded Python interpreters.John Senneker2021-11-302-216/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #2101. There are 3 related changes made here: 1. Move the SWIG_globals() singleton into pyrun from pyint so it is visible to SWIG_Python_DestroyModule(). The static globals varlink has been extracted out of the function so that it can be set to NULL in SWIG_Python_DestroyModule(), which fixes the issue described in #2101. (Now when the second interpreter starts up, the Swig_Globals_global pointer will be NULL, so it knows it has to create a new one.) 2. Remove a Py_DECREF on the globals varlink. The decrement is now performed by DestroyModule(), so there's no need to do it in SWIG_init(). 3. Fixed similar issue with SWIG_Python_TypeCache().
* | [js] Remove code to handle v8 < 5.0Olly Betts2021-12-026-413/+10
| | | | | | | | | | We require at least node v6 which means v8 5.0, so code to handle older v8 is no longer useful.
* | Merge branch 'fix_SWIG_V8_VERSION'William S Fulton2021-12-011-1/+4
|\ \ | | | | | | | | | | | | * fix_SWIG_V8_VERSION: [javascript][v8] SWIG_V8_VERSION generation method corrected.
| * | [javascript][v8] SWIG_V8_VERSION generation method corrected.Hirokazu MORIKAWA2021-05-011-1/+4
| | | | | | | | | | | | | | | | | | "SWIG_V8_VERSION" generation method was incorrectly fixed. Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
* | | Fix typosDimitris Apostolou2021-11-174-7/+7
| |/ |/|
* | Scilab compilation fix when wrapping C++11 enum classesWilliam S Fulton2021-11-151-1/+1
| |
* | Lua int ref typemap improvementsWilliam S Fulton2021-11-121-4/+4
| | | | | | | | | | Fixes complex typedefs to const int& and const unsigned int&. Fixes cpp11_type_aliasing testcase
* | Fix mismatched new char[] and free() - JavascriptWilliam S Fulton2021-11-121-1/+1
| | | | | | | | | | | | | | | | Javascript - v8 and node only. When wrapping C code char arrays. Now calloc is now used instead of new char[] in SWIG_AsCharPtrAndSize. Fixes gcc-11 warning -Wmismatched-new-delete in arrays and memberin_extend testcases.
* | Avoid gcc 11 misleading indentation warning in generated codeAnthony Heading2021-10-031-1/+3
| | | | | | | | Closes https://github.com/swig/swig/pull/2074
* | swig -go: don't use crosscall2 for panickingIan Lance Taylor2021-09-151-52/+1
| | | | | | | | Instead rely only on documented and exported interfaces.
* | remove Go -no-cgo optionIan Lance Taylor2021-09-141-146/+0
| | | | | | | | | | It only worked for Go versions before 1.5, which is more than five years ago and long-unsupported.
* | Replace remaining PHP errors with PHP exceptionsOlly Betts2021-05-265-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `SWIG_ErrorCode()`, `SWIG_ErrorMsg()`, `SWIG_FAIL()` and `goto thrown;` are no longer supported (these are really all internal implementation details and none are documented aside from brief mentions in CHANGES for the first three). I wasn't able to find any uses at least in FOSS code via code search tools. If you are using these: Use `SWIG_PHP_Error(code,msg);` instead of `SWIG_ErrorCode(code); SWIG_ErrorMsg(msg);` (which will throw a PHP exception in SWIG >= 4.1 and do the same as the individual calls in older SWIG). `SWIG_FAIL();` and `goto thrown;` can typically be replaced with `SWIG_fail;`. This will probably also work with older SWIG, but please test with your wrappers if this is important to you. Fixes #2014
* | php: Throw exceptions instead of using errorsOlly Betts2021-05-253-14/+26
| | | | | | | | | | | | | | | | Parameter type errors and some other cases in SWIG-generated wrappers now throw a PHP exception, which is how PHP's native parameter handling deals with similar situations. See #2014, but not closing yet as there may be more cases to convert.
* | php: SWIG_exception now maps code to exception classOlly Betts2021-05-251-1/+12
| | | | | | | | | | | | | | | | | | | | This now determines the class of the exception object where a suitable pre-defined PHP exception class exists - for example, SWIG_TypeError -> PHP exception class TypeError. Exception codes which don't naturally map to a pre-defined PHP exception class are thrown as PHP class Exception (like all PHP exceptions raised by SWIG_exception were before this change.)
* | Map known PHP interfaces to zend_class_entry*Olly Betts2021-05-253-0/+67
| | | | | | | | | | | | | | | | | | | | | | Most pre-defined interfaces are accessible via zend_class_entry* variables declared in the PHP C API - we can use these to add an interface at MINIT time (rather than having to wait until RINIT to look up by name) by having a mapping from PHP interface name to them. This will also be a little faster than looking up by name. Closes #2013
* | Further leak fixesAndrew Rogers2021-05-181-23/+43
| |
* | Update tests for failing Python API calls to all use '!= 0'Andrew Rogers2021-05-181-4/+4
| |
* | Tidy up handling of OOM exceptions - Py*_New will call PyErr_NoMemory() ↵Andrew Rogers2021-05-171-5/+1
| | | | | | | | internally, so there is no need to call it again here, just correctly handle the NULL return value
* | Merge remote-tracking branch 'upstream/master' into memleakAndrew Rogers2021-05-1724-4749/+0
|\ \ | | | | | | | | | | | | # Conflicts: # CHANGES.current
| * | [UFFI] Remove code for Common Lisp UFFIOlly Betts2021-05-161-101/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
| * | [Pike] Remove code for PikeOlly Betts2021-05-164-512/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
| * | [Modula3] Remove code for Modula3Olly Betts2021-05-163-925/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
| * | [CLISP] Remove code for GNU Common LispOlly Betts2021-05-161-32/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
| * | [Chicken] Remove code for ChickenOlly Betts2021-05-169-1961/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
| * | [Allegrocl] Remove code for Allegro Common LispOlly Betts2021-05-136-1218/+0
| | | | | | | | | | | | | | | | | | | | | We dropped support for it in SWIG 4.0.0 and nobody has stepped forward to revive it in over 2 years. See #2009.
* | | [Python] Fix memory leaks.Andrew Rogers2021-05-122-29/+64
|/ /
* | [php] Fix reserved class names TRUE, FALSE, NULLOlly Betts2021-05-121-4/+5
| | | | | | | | | | | | PHPCN(x) does a string compare of x with the lower-cased class name, so x needs to be in lowercase or else the entry has no effect. The entries for TRUE, FALSE and NULL weren't working as a result.
* | [php] Update keyword listOlly Betts2021-05-121-17/+17
| | | | | | | | | | | | | | | | | | Add some missing entries, remove some long obsolete entries (from the "ming" extension for generating SWF files, which was split out from PHP core in 2008), and entry for "static" as a reserved class name (`static::` is used for late static bindings, but attempting to name a PHP class `static` fails because `static` is a keyword and we also list it as such).
* | Fix uses of uninitialised zvalOlly Betts2021-05-051-0/+2
| | | | | | | | | | SWIG_SetPointerZval() now checks if the passed zval is an object, so use ZVAL_UNDEF() before in cases where we create a zval to pass.
* | Clean up includes of PHP API headersOlly Betts2021-05-051-4/+3
| | | | | | | | | | | | | | | | Eliminate redundant and unused includes. Only include the minimum headers needed before the PHP_MAJOR_VERSION check in case future PHP versions remove some of the headers we include.
* | [php] Remove redundant conditional includeOlly Betts2021-05-051-1/+0
| | | | | | | | We always include zend_exceptions.h via phprun.swg.
* | Fix segfault in exception class creationOlly Betts2021-05-041-0/+1
| | | | | | | | | | We can't safely lookup the Exception class entry at MINIT time, but we can just use zend_ce_exception instead, which will be a bit faster too.
* | php: Stop using dl()Olly Betts2021-05-031-2/+8
| | | | | | | | | | | | | | | | With modern PHP it only works with the CLI version of PHP, so it's better to direct users to load the extension via "extension=" in php.ini. Suggested by ferdynator in #1529.