Skip to content

Commit 0356177

Browse files
authored
Merge pull request #373 from jbpoittevin/fix_collections_iterable
fix AttributeError: module 'collections' has no attribute 'Iterable'
2 parents 4ad432d + 4819bbc commit 0356177

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ftplugin/orgmode/liborgmode/base.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
except:
1414
from UserList import UserList
1515

16-
import collections
16+
try:
17+
from collections.abc import Iterable
18+
except ImportError:
19+
# preserve compatibility with python < 3.10
20+
from collections import Iterable
21+
1722
import sys
1823
from orgmode.py3compat.unicode_compatibility import *
1924

@@ -31,7 +36,7 @@ def flatten_list(lst):
3136
def gen_lst(item):
3237
if isinstance(item, basestring) or isinstance(item, bytes):
3338
yield item
34-
elif isinstance(item, collections.Iterable):
39+
elif isinstance(item, Iterable):
3540
# yield from would be so nice... but c'est la vie
3641
for val in item:
3742
for final in gen_lst(val):

0 commit comments

Comments
 (0)