diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-05-09 12:30:28 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-05-11 09:57:38 -0700 |
commit | e419198ff879f74663a7c4d71f2a24f125d27de1 (patch) | |
tree | 95c9c66a24374706be1b8567b9fa7c1e1acb2916 | |
parent | 1a87c967f18b6b212f2c7326f2382123cf43c6bc (diff) | |
download | meson-e419198ff879f74663a7c4d71f2a24f125d27de1.zip meson-e419198ff879f74663a7c4d71f2a24f125d27de1.tar.gz meson-e419198ff879f74663a7c4d71f2a24f125d27de1.tar.bz2 |
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.
-rw-r--r-- | mesonbuild/mesonlib.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 54e8016..6937502 100644 --- a/mesonbuild/mesonlib.py +++ b/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): |