Commit graph

18,522 commits

Author SHA1 Message Date
William S Fulton
b886a54fce Merge branch 'amaeldoe-master'
* 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
2015-04-11 12:37:11 +01:00
William S Fulton
1a64e74c46 Add python runtime test for dynamically added attributes
From #320
2015-04-11 12:35:58 +01:00
William S Fulton
3f549a2a5f Correct changes notes on %pythonnondynamic usage 2015-04-10 20:34:01 +01:00
Yoann Vandoorselaere
327d7c968d Attribute of SWIG wrapped classes instances were overwritten on __init__()
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
2015-04-11 02:05:11 +07:00
Yoann Vandoorselaere
3983d7b230 Fix SwigPyObject->dict memory leak
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==
2015-04-11 02:05:11 +07:00
Yoann Vandoorselaere
92b88db7ab Make __dict__ accessible for Python builtin classes
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.
2015-04-11 02:05:06 +07:00
William S Fulton
fa4223e496 Fix parsing of extern "C" and typedef for example:
extern "C" typedef void (*Hook2_t)(int, const char *);
extern "C" typedef int Integer;

Closes #375
2015-04-07 21:34:23 +01:00
William S Fulton
d62aad9de9 Remove unwanted x bit in configure.ac 2015-04-04 10:23:44 +01:00
William S Fulton
6c76c7bb75 Appveyor - don't show env variables anymore 2015-04-04 02:24:14 +01:00
William S Fulton
10c34adf25 Merge branch 'wsfulton-appveyor2'
* wsfulton-appveyor2:
  Appveyor: partialcheck test-suite
  Remove appveyor debugging code
  Add CI testing for Windows using Appveyor
  Python 2 and 3 testing on Windows
  Detect Java on 64 bit windows
  Allow for spaces in path to java include directory and executables
  gcc and mno-cygwin tweaks on cygwin/mingw
  preinst-swig script support for native windows paths
  Add CSHARPOPTIONS for users to customise C# compiler flags
  Portability fixes for python example
  PY3 fixes for import_package example
  Update AX_PATH_GENERIC for spaces support
  Add support for Windows in AX_BOOST_BASE
  CSharp test-suite support on windows
2015-04-04 02:18:15 +01:00
William S Fulton
083c75e9b6 Appveyor: partialcheck test-suite
Java and Python time out when running just the test-suite.
Compromise for now... run just partialcheck-test-suite, ie
test just invoking SWIG and not C/C++compile and run tests.
2015-04-04 02:17:57 +01:00
William S Fulton
b0e0237347 Remove appveyor debugging code 2015-04-04 02:17:57 +01:00
William S Fulton
1445b364ff Add CI testing for Windows using Appveyor
appveyor.yml file for testing at http://appveyor.com/
2015-04-04 02:17:57 +01:00
William S Fulton
62fdff1bf3 Python 2 and 3 testing on Windows 2015-04-04 02:17:57 +01:00
William S Fulton
0f1e8f75da Detect Java on 64 bit windows 2015-04-04 02:17:57 +01:00
William S Fulton
f27faa9c69 Allow for spaces in path to java include directory and executables
For typical Windows installs of Java.
Also don't use cygpath on MinGW.
2015-04-04 02:17:57 +01:00
William S Fulton
a57302527a gcc and mno-cygwin tweaks on cygwin/mingw 2015-04-04 02:17:57 +01:00
William S Fulton
af06a48430 preinst-swig script support for native windows paths
- SWIG_LIB support for testing on Windows
- Only in-source builds for now
2015-04-04 02:17:57 +01:00
William S Fulton
3d61e84be6 Add CSHARPOPTIONS for users to customise C# compiler flags 2015-04-04 02:17:57 +01:00
William S Fulton
ec7e7145aa Portability fixes for python example 2015-04-04 02:17:57 +01:00
William S Fulton
f6e25f5786 PY3 fixes for import_package example 2015-04-04 02:17:57 +01:00
William S Fulton
e544ce8f82 Update AX_PATH_GENERIC for spaces support
Fix when the _CFLAGS and _LIBS are provided and they contain a space

For example:
./configure PCRE_LIBS='-L/home/me/pcre/lib -lpcre'

Serial number 13 in autoconf macro archive
2015-04-04 02:17:57 +01:00
William S Fulton
e60445b280 Add support for Windows in AX_BOOST_BASE
Serial 26 in autoconf macro archive
2015-04-04 02:17:57 +01:00
William S Fulton
2347e87451 CSharp test-suite support on windows
- Add pathconvert tool to convert to a windows path for input files for
  C# compiler
- Simplify vcfilter
2015-04-04 02:17:56 +01:00
Olly Betts
084f72452f Fix javadowncast to csdowncast in C# backend
See issue#367.
2015-03-30 08:38:24 +13:00
Olly Betts
dba8d4a7ea Add regression test for 6b6b360
Reported in issue#368 by clintonstimpson.
2015-03-28 11:26:13 +13:00
Olly Betts
6b6b360093 Fix segfault in handling unknown directives 2015-03-27 18:14:03 +13:00
Olly Betts
38a75a22c9 "suppport" -> "support" 2015-03-27 12:54:47 +13:00
Olly Betts
01d0ee86e0 Fix C&P references to Python in comments 2015-03-27 12:40:42 +13:00
Olly Betts
2c08e33099 Correct java warning to save javabase not csbase 2015-03-27 12:30:19 +13:00
Olly Betts
45c0a15760 Merge pull request #367 from jamesathey/csharp-cleanup
When warning about multiple inheritance in C#, say C# in the message
2015-03-27 12:20:26 +13:00
James Athey
7a050461c6 When warning about multiple inheritance in C#, say C# in the message instead of Java 2015-03-26 11:11:11 -04:00
Olly Betts
226b4dec5b Probe for camlp4 in configure
See issue #364.
2015-03-25 12:44:05 +13:00
Simon Marchetto
4c6f29b778 scilab: fix possible crash by using consistent allocation/free methods (use SWIG macros) 2015-03-24 16:52:18 +01:00
Simon Marchetto
cfebdc36af scilab: compile examples & test-suite with debug infos 2015-03-24 16:52:18 +01:00
Simon Marchetto
ec6d46f387 scilab: fix doc typos 2015-03-24 16:52:18 +01:00
Olly Betts
b7ea2115c4 Merge pull request #338 from thomascirca/node-doc
Corrected the link for documentation relating to NodeJS, and added one c...
2015-03-23 20:15:41 +13:00
Olly Betts
af113fa6f0 Add missing ; after C++ class definitions 2015-03-20 13:46:28 +13:00
Olly Betts
c8a7322a4d Use %{ %} instead of { } after %pythoncode
Simpler and safer change to address PR#357.
2015-03-20 13:45:19 +13:00
Olly Betts
3bc5348bd2 Update comment about ocamldlgen 2015-03-19 15:05:31 +13:00
Olly Betts
13894f803b Whitespace cleanup 2015-03-19 13:15:23 +13:00
Olly Betts
064f18131d Fix "check_quant" target in ocaml testsuite
Previously it would be confused by testcases names which were a suffix
of another testcase name (e.g. name and keyword_rename).
2015-03-18 15:49:48 +13:00
Olly Betts
7af659ccaa ocaml testsuite is not in good shape 2015-03-18 15:18:44 +13:00
Olly Betts
7eb890e64f Fix typo in forward declaration 2015-03-18 13:42:53 +13:00
Olly Betts
f2c2baf2af Remove bogus comment 2015-03-18 13:39:26 +13:00
Olly Betts
b7557aeb03 Add ocaml to travis 2015-03-18 13:31:10 +13:00
Olly Betts
2278c9b33d Remove pointless export of variables 2015-03-18 13:12:57 +13:00
Olly Betts
eec4e7e2ee Use the ocamlc configure found 2015-03-18 13:12:12 +13:00
Olly Betts
6d80e40699 Remove dead Ocaml configure probes
A number of the probed for values are no longer actually used anywhere.
2015-03-18 13:10:59 +13:00
Olly Betts
c7c6f2381e Eliminate AC_COMPARE_VERSION
We also have AX_COMPARE_VERSION which does essentially the same job.
2015-03-18 12:39:57 +13:00