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.
@@ -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):
