Notably it now works for "unsigned char*" strings.
Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
* appveyor-check-test-suite:
Appveyor testing expanded
Fix array overrun in li_carrays testcase
Warning fixes in generated Python code for 64bit Visual C++ on Windows.
Warning fixes in generated C# code for 64bit Visual C++ on Windows.
Warning fixes for 64bit visual c++ on Windows
Warning fixes in generated Java code for 64bit Visual C++ on Windows.
Warning fixes for 64bit visual c++ on Windows
C# gc tests failure fix
Add a space between literal and string macro
Since Lua 5.3 the "%c" format character in lua_pushfstring will produce
the string "<\XXX>" (XXX being a decimal code sequence) when
given unprintable characters.
Use lua_pushlstring instead to reproduce the old behavior.
When passing a byte array from c++ to Java using the director feature, the generated jni code does not release a temporary byte array.
This is the typemap specified in Java.swg:
%typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) {
jbyteArray jb = (jenv)->NewByteArray($2);
(jenv)->SetByteArrayRegion(jb, 0, $2, (jbyte *)$1);
$input = jb;
}
%typemap(directorargout) (char *STRING, size_t LENGTH)
%{(jenv)->GetByteArrayRegion($input, 0, $2, (jbyte *)$1); %}
Notice that the call to NewByteArray doesn't contain a symmetric release logic as the SetByteArrayRegion/GetByteArrayRegion does.
Closes#386
_swig_makegostring will no longer work in the Go 1.5 release.
Keep the existing code so that existing users with current versions of
Go will not break suddenly.
* amaeldoe-master:
Add python runtime test for dynamically added attributes
Attribute of SWIG wrapped classes instances were overwritten on __init__()
Fix SwigPyObject->dict memory leak
Make __dict__ accessible for Python builtin classes
When a SWIG classes instances is initialized, its internal dictionary was
reset to NULL, which result in the loss of any attribute that might have
been set for the instance.
Only initialize the internal dictionary on actual PyObject creation.
class Test(MySwigWrappedClass):
def __init__(self):
self.val = "Random Value"
MySwigWrappedClass.__init__(self)
p = Test()
print hasattr(p, "val") # Should return True, but used to return False
The following patch attempt to fix a memory leak happening when a
random class attribute is set. The internal instance dictionary is
created but never freed.
This fixes the problem for me, although I am not sure the patch
is correct.
<code>
p = MySWIGClass()
p.random_attribute = 0
</code>
Valgrind report:
==18267== 280 bytes in 1 blocks are definitely lost in loss record 1,372 of 1,780
==18267== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18267== by 0x3A90A885DC: PyObject_Malloc (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90B101A8: _PyObject_GC_Malloc (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90B102AC: _PyObject_GC_New (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90A80943: PyDict_New (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90A6E8FC: PyFrame_New (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AE1A65: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AE088E: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AE21DC: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AE22E1: PyEval_EvalCode (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AFB71E: ??? (in /usr/lib64/libpython2.7.so.1.0)
==18267== by 0x3A90AFC8DD: PyRun_FileExFlags (in /usr/lib64/libpython2.7.so.1.0)
==18267==
Attribute set within instance of a SWIG Python wrapped class are
stored in SwigPyObject->dict, which tp_dictoffset slot is pointing to.
However, SWIG wrapped classes did not have a __dict__ attribute.
Inheriting subclasses did not get the attribute either because the
SWIG wrapped classes initialize the tp_dictoffset slot:
From http://bugs.python.org/issue16272:
"If a type defines a nonzero tp_dictoffset, that type is responsible for
defining a `__dict__` slot as part of the tp_getset structures. Failure to
do so will result in the dict being inaccessible from Python via
`obj.__dict__` from instances of the type or subtypes."
Provide a SwigPyObject_get___dict__() function to retrieve the dict
attribute or create it when it does not exist yet (it is normally
created when setting attribute set), and a PyGetSetDef entry pointing
to this function.
In future releases of Go it will not be possible to pass Go pointers
into C/C++ code. The handle is automatically translated back to the
Go value using a Go map. Since directors must be explicitly deleted,
we can reliably use that call to remove the handle from the map.
* stricter-warnings:
Go changes for wrappers to compile as ISO C90
Scilab typecheck typemaps fix for C90
No error for one Javascript node warning
Warning fix in testcase for Javascript node
nested_extend_c testcase fix when compiled by C++ target languages
Temporarily remove -Werror for Scilab testing
C90 fixes for Javascript JSC
There are a couple of testcases that aren't compliant and supression via pragmas doesn't work for gcc < 4.8
Warning suppression change
Scilab typemap fixes for C89
compiler warning suppression correction in testcase
Suppress pedantic warnings in C# testcases
Suppress pedantic warnings in testcases
Pedantic warning fix in testcase
pedantic warning fix for D wrappers
Travis testing to use testflags.py for setting CFLAGS and CXXFLAGS
Add travis build for error-declaration-after-statement branch