diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-10-21 14:11:58 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:18:31 -0300 |
commit | dc022d65ce87882fdf6add900038e957f399453b (patch) | |
tree | dc5e9ec973ab7f1eccdaed0b475c37770a0ef976 /tests/samplebinding | |
parent | 4a05efa3768e572c72aea594506ca7ddd5639712 (diff) |
Fix crash in PySequence converters.
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 2d3339842..f80801670 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -185,8 +185,9 @@ <target-to-native> <add-conversion type="PySequence"> %OUTTYPE& list = %out; - for (int i = 0; i < PySequence_Fast_GET_SIZE(%in); i++) { - PyObject* pyItem = PySequence_Fast_GET_ITEM(%in, i); + Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0)); + for (int i = 0; i < PySequence_Fast_GET_SIZE(seq.object()); i++) { + PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i); PStr cppItem = %CONVERTTOCPP[PStr](pyItem); list.push_back(cppItem); } @@ -239,8 +240,9 @@ return %out; </template> <template name="pyseq_to_cpplist_convertion"> - for (int i = 0; i < PySequence_Fast_GET_SIZE(%in); i++) { - PyObject* pyItem = PySequence_Fast_GET_ITEM(%in, i); + Shiboken::AutoDecRef seq(PySequence_Fast(%in, 0)); + for (int i = 0; i < PySequence_Fast_GET_SIZE(seq.object()); i++) { + PyObject* pyItem = PySequence_Fast_GET_ITEM(seq.object(), i); %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); %out.push_back(cppItem); } |