mirror of https://github.com/swig/swig
Python - fix compilation error when using -extranative and -builtin.
Closes #816
This commit is contained in:
parent
20cd562e62
commit
bdda0a0829
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 3.0.11 (in progress)
|
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
|
2016-11-02: liorgold
|
||||||
Patch #741 - Add support for C++11 alias templates, see updated CPlusPlus11.html
|
Patch #741 - Add support for C++11 alias templates, see updated CPlusPlus11.html
|
||||||
documentation.
|
documentation.
|
||||||
|
|
|
@ -62,6 +62,7 @@ CPP_TEST_CASES += \
|
||||||
python_destructor_exception \
|
python_destructor_exception \
|
||||||
python_director \
|
python_director \
|
||||||
python_docstring \
|
python_docstring \
|
||||||
|
python_extranative \
|
||||||
python_nondynamic \
|
python_nondynamic \
|
||||||
python_overload_simple_cast \
|
python_overload_simple_cast \
|
||||||
python_pickle \
|
python_pickle \
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
%module(extranative="1") python_extranative
|
||||||
|
|
||||||
|
%include <std_vector.i>
|
||||||
|
%include <std_string.i>
|
||||||
|
|
||||||
|
%template(VectorString) std::vector<std::string>;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
std::vector<std::string> make_vector_string() {
|
||||||
|
std::vector<std::string> vs;
|
||||||
|
vs.push_back("one");
|
||||||
|
vs.push_back("two");
|
||||||
|
return vs;
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ namespace swig {
|
||||||
%#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
|
%#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
|
||||||
swig_type_info *desc = swig::type_info<sequence>();
|
swig_type_info *desc = swig::type_info<sequence>();
|
||||||
if (desc && desc->clientdata) {
|
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
|
%#endif
|
||||||
size_type size = seq.size();
|
size_type size = seq.size();
|
||||||
|
|
Loading…
Reference in New Issue