Skip to content

Commit 5cdfca7

Browse files
committed
Update bindings generator script for python 3.10+
Added fix in order to address previously unresolved issue when building in environments with python 3.10+. Modified so that this fix does not effect 3.9 or less.
1 parent 178be1e commit 5cdfca7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/matlab/generator/parse_tree.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import collections
1+
import sys
2+
if sys.version_info >= (3, 10):
3+
import collections.abc
4+
IterableType = collections.abc.Iterable
5+
else:
6+
import collections
7+
IterableType = collections.Iterable
28
from textwrap import fill
39
from filters import *
410
try:
@@ -371,7 +377,7 @@ def todict(obj):
371377
return obj
372378
elif isinstance(obj, dict):
373379
return dict((key, todict(val)) for key, val in obj.items())
374-
elif isinstance(obj, collections.Iterable):
380+
elif isinstance(obj, IterableType):
375381
return [todict(val) for val in obj]
376382
elif hasattr(obj, '__dict__'):
377383
return todict(vars(obj))

0 commit comments

Comments
 (0)