Skip to content

Commit 9821eaf

Browse files
committed
Fix issue on Python 3.13.1
For some reason, python/cpython#125846 broke the ability to iterate over `HocObject`s, so as a workaround, we can first cast it to a Python list.
1 parent 01320a7 commit 9821eaf

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

test/hoctests/tests/test_thread_partition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def assertpart(parts="default"):
3838
if str(parts) == "default": # not round-robin but root order
3939
roots = h.SectionList()
4040
roots.allroots()
41-
roots = [root for root in roots]
41+
roots = [root for root in list(roots)]
4242
i = 0
4343
for ith in range(pc.nthread()):
4444
sl = pc.get_partition(ith)

test/pytest_coreneuron/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_HocObject_no_deferred_unref():
209209
for sec in h.allsec():
210210
print(sec)
211211
sl.append(sec=sec)
212-
assert len([s for s in sl]) == 0
212+
assert len([s for s in list(sl)]) == 0
213213

214214

215215
def test_deleted_sec():

test/pytest_coreneuron/test_zptrlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_rvp(): # for coverage of ptrlist changes in nrniv/shape.cpp
4949
assert rvp.right() == 30.0
5050
sl = h.SectionList()
5151
rvp.list(sl)
52-
sz = sum([1 for _ in sl])
52+
sz = sum([1 for _ in list(sl)])
5353
assert sz == 3
5454

5555

0 commit comments

Comments
 (0)