Flatten should always return a list

Currently if flatten() is passed a non-list object, it returns that
object. This is surprising behavior, and prone to causing serious and
numerous problems, since many objects implement the iterable interface,
and thus can be used in cases a list is expected, but with undesirable
results.
pull/1735/head
Dylan Baker 8 years ago
parent 1a87c967f1
commit e419198ff8
  1. 2
      mesonbuild/mesonlib.py

@ -203,7 +203,7 @@ def classify_unity_sources(compilers, sources):
def flatten(item):
if not isinstance(item, list):
return item
return [item]
result = []
for i in item:
if isinstance(i, list):

Loading…
Cancel
Save