I am trying to go from: SWIG 2.0.11 and Python 2.7.12 to SWIG 3.0.12 and Python 3.6, but I get the following exception when I run tests on any iterator (automatically generated using the% pattern):
SystemError: <built-in function xxx_iterator> returned a result with an error set
For example, even the simplest iteration fails:
Traceback (most recent call last):
File "testRender.py", line 459, in testRender
for v in vertices:
File "ncore.py", line 90833, in __iter__
return self.iterator()
File "ncore.py", line 90830, in iterator
return _ncore.Vertices_iterator(self)
SystemError: <built-in function Vertices_iterator> returned a result with an error set
Any ideas?
Again, all this works fine with SWIG 2.0.11 and Python 2.7.12 ....
Edit: adding a simpler example:
It can be ANY template iterator with a template, therefore, for example, this template defined in the .i file:
%template(Ints) std::list<int>;
It will crash when using this simple code:
intsList = ncore.Ints()
intsList.append(1)
intsList.append(2)
for i in intsList:
print(i)
with a message similar to this:
Traceback (most recent call last):
File "testRender.py", line 459, in testRender
for i in intsList:
File "ncore.py", line 90833, in __iter__
return self.iterator()
File "ncore.py", line 90830, in iterator
return _ncore.Ints_iterator(self)
SystemError: <built-in function Ints_iterator> returned a result with an error set