Skip to content

Commit

Permalink
Merge pull request jceb#373 from jbpoittevin/fix_collections_iterable
Browse files Browse the repository at this point in the history
fix AttributeError: module 'collections' has no attribute 'Iterable'
  • Loading branch information
jceb authored Jan 3, 2022
2 parents 4ad432d + 4819bbc commit 0356177
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ftplugin/orgmode/liborgmode/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
except:
from UserList import UserList

import collections
try:
from collections.abc import Iterable
except ImportError:
# preserve compatibility with python < 3.10
from collections import Iterable

import sys
from orgmode.py3compat.unicode_compatibility import *

Expand All @@ -31,7 +36,7 @@ def flatten_list(lst):
def gen_lst(item):
if isinstance(item, basestring) or isinstance(item, bytes):
yield item
elif isinstance(item, collections.Iterable):
elif isinstance(item, Iterable):
# yield from would be so nice... but c'est la vie
for val in item:
for final in gen_lst(val):
Expand Down

0 comments on commit 0356177

Please sign in to comment.