@@ -80,6 +80,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
8080 PyObject* element = PySequence_GetItem ($input, i);
8181 void *arg = 0 ;
8282 int res = SWIG_ConvertPtr (element, &arg, SWIGTYPE_p_IfcParse__declaration, 0 );
83+ Py_DECREF (element);
8384 auto decl = static_cast <const IfcParse::declaration*>(SWIG_IsOK (res) ? arg : 0 );
8485 if (decl) {
8586 $1 ->push_back (decl);
@@ -99,6 +100,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
99100 PyObject* element = PySequence_GetItem ($input, i);
100101 void *arg = 0 ;
101102 int res = SWIG_ConvertPtr (element, &arg, SWIGTYPE_p_IfcParse__entity, 0 );
103+ Py_DECREF (element);
102104 auto decl = static_cast <const IfcParse::entity*>(SWIG_IsOK (res) ? arg : 0 );
103105 if (decl) {
104106 $1 ->push_back (decl);
@@ -118,6 +120,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
118120 PyObject* element = PySequence_GetItem ($input, i);
119121 void *arg = 0 ;
120122 int res = SWIG_ConvertPtr (element, &arg, SWIGTYPE_p_IfcParse__attribute, 0 );
123+ Py_DECREF (element);
121124 auto decl = static_cast <const IfcParse::attribute*>(SWIG_IsOK (res) ? arg : 0 );
122125 if (decl) {
123126 $1 ->push_back (decl);
@@ -137,6 +140,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
137140 PyObject* element = PySequence_GetItem ($input, i);
138141 void *arg = 0 ;
139142 int res = SWIG_ConvertPtr (element, &arg, SWIGTYPE_p_IfcParse__inverse_attribute, 0 );
143+ Py_DECREF (element);
140144 auto decl = static_cast <const IfcParse::inverse_attribute*>(SWIG_IsOK (res) ? arg : 0 );
141145 if (decl) {
142146 $1 ->push_back (decl);
@@ -155,6 +159,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
155159 for (Py_ssize_t i = 0 ; i < PySequence_Size ($input); ++i) {
156160 PyObject* element = PySequence_GetItem ($input, i);
157161 $1 ->push_back (PyObject_IsTrue (element));
162+ Py_DECREF (element);
158163 }
159164 } else {
160165 SWIG_exception (SWIG_TypeError, " Expected an sequence type" );
@@ -167,6 +172,7 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
167172 for (Py_ssize_t i = 0 ; i < PySequence_Size ($input); ++i) {
168173 PyObject* element = PySequence_GetItem ($input, i);
169174 IfcUtil::IfcBaseClass* inst = cast_pyobject<IfcUtil::IfcBaseClass*>(element);
175+ Py_DECREF (element);
170176 if (inst) {
171177 $1 ->push (inst);
172178 } else {
@@ -183,23 +189,28 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
183189 $1 = aggregate_of_aggregate_of_instance::ptr (new aggregate_of_aggregate_of_instance ());
184190 for (Py_ssize_t i = 0 ; i < PySequence_Size ($input); ++i) {
185191 PyObject* element = PySequence_GetItem ($input, i);
192+ bool b = false ;
186193 if (PySequence_Check (element)) {
194+ b = true ;
187195 std::vector<IfcUtil::IfcBaseClass*> vector;
188196 vector.reserve (PySequence_Size (element));
189197 for (Py_ssize_t j = 0 ; j < PySequence_Size (element); ++j) {
190198 PyObject* element_element = PySequence_GetItem (element, j);
191199 IfcUtil::IfcBaseClass* inst = cast_pyobject<IfcUtil::IfcBaseClass*>(element_element);
200+ Py_DECREF (element_element);
192201 if (inst) {
193- vector.push_back (cast_pyobject<IfcUtil::IfcBaseClass*>(element_element) );
202+ vector.push_back (inst );
194203 } else {
195204 SWIG_exception (SWIG_TypeError, " Attribute of type AGGREGATE OF AGGREGATE OF ENTITY INSTANCE needs a python sequence of sequence of entity instances" );
196- }
205+ }
197206 }
198207 $1 ->push (vector);
199- } else {
208+ }
209+ Py_DECREF (element);
210+ if (!b) {
200211 SWIG_exception (SWIG_TypeError, " Attribute of type AGGREGATE OF AGGREGATE OF ENTITY INSTANCE needs a python sequence of sequence of entity instances" );
201212 break ;
202- }
213+ }
203214 }
204215 } else {
205216 SWIG_exception (SWIG_TypeError, " Attribute of type AGGREGATE OF AGGREGATE OF ENTITY INSTANCE needs a python sequence of sequence of entity instances" );
0 commit comments