diff --git a/CHANGES.current b/CHANGES.current index 910cc42f3..3e5e712fe 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.11 (in progress) ============================ +2016-11-02: wsfulton + [Python] Issue #816 - fix compilation error when using -extranative and -builtin. + 2016-11-02: liorgold Patch #741 - Add support for C++11 alias templates, see updated CPlusPlus11.html documentation. diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 033b83103..8ccb1b306 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -62,6 +62,7 @@ CPP_TEST_CASES += \ python_destructor_exception \ python_director \ python_docstring \ + python_extranative \ python_nondynamic \ python_overload_simple_cast \ python_pickle \ diff --git a/Examples/test-suite/python/python_extranative_runme.py b/Examples/test-suite/python/python_extranative_runme.py new file mode 100644 index 000000000..7be13a7ee --- /dev/null +++ b/Examples/test-suite/python/python_extranative_runme.py @@ -0,0 +1,11 @@ +import python_extranative + +vs = python_extranative.make_vector_string() +if not isinstance(vs, python_extranative.VectorString): + # will be of type tuple if extranative not working + raise RuntimeError("Not of type VectorString") + +for s1, s2 in zip(vs, ["one", "two"]): + if s1 != s2: + raise RuntimeError("Mismatch: " + s1 + " " + s2) + diff --git a/Examples/test-suite/python_extranative.i b/Examples/test-suite/python_extranative.i new file mode 100644 index 000000000..04361b3e6 --- /dev/null +++ b/Examples/test-suite/python_extranative.i @@ -0,0 +1,16 @@ +%module(extranative="1") python_extranative + +%include +%include + +%template(VectorString) std::vector; + +%inline %{ +std::vector make_vector_string() { + std::vector vs; + vs.push_back("one"); + vs.push_back("two"); + return vs; +} +%} + diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index 8463e28f8..d697ffdac 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -1012,7 +1012,7 @@ namespace swig { %#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS swig_type_info *desc = swig::type_info(); if (desc && desc->clientdata) { - return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); + return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); } %#endif size_type size = seq.size();