nest-simulator
nest-simulator copied to clipboard
Iterating on an empty `SynapseCollection` raises `TypeError: 'NoneType' object is not iterable`
Describe the bug
Iterating on an empty SynapseCollection raises TypeError: 'NoneType' object is not iterable.
It seems that this is caused by:
- When
SynapseCollectionis empty, its _datum field is None - Constructor of SynapseCollectionIterator doesn't check for this case.
To Reproduce Steps to reproduce the behavior:
>>> s = nest.SynapseCollection(None)
>>> for row in s:
... pass
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/nest/lib/python3.10/site-packages/nest/lib/hl_api_types.py", line 608, in __iter__
return SynapseCollectionIterator(self)
File "/opt/nest/lib/python3.10/site-packages/nest/lib/hl_api_types.py", line 567, in __init__
self._iter = iter(synapse_collection._datum)
TypeError: 'NoneType' object is not iterable
Expected behavior SynapseCollectionIterator creates an empty iterator when the collection is empty.
Desktop/Environment (please complete the following information):
- OS: Ubuntu 22.04
- Shell: bash
- Python-Version: 3.10.12
- NEST-Version: 3.5.0
- Installation: docker
Issue automatically marked stale!