From 845dbfcbbc40b0060b1ed7d7df0431c5f4a11497 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sat, 17 Feb 2018 19:53:54 +0000 Subject: [PATCH] Handle a warning location which evaluates to False As written in PR #2856, this code isn't quite right. An ArgumentNode object can evaluate as False (if it's arguments attribute is an empty sequence). If that happens, we then try to hand the location kwarg down to print(), rather than removing it, which causes an invalid keyword argument exception. This failure can be seen e.g. when generating for gnome-twitch (See [1]) [1] https://travis-ci.org/jon-turney/meson-corpus-test/jobs/343017109 --- mesonbuild/mlog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py index 273552d6c..3c34b8514 100644 --- a/mesonbuild/mlog.py +++ b/mesonbuild/mlog.py @@ -107,7 +107,7 @@ def warning(*args, **kwargs): args = (yellow('WARNING:'),) + args - if kwargs.get('location'): + if 'location' in kwargs: location = kwargs['location'] del kwargs['location'] location = '{}:{}:'.format(os.path.join(location.subdir, environment.build_filename), location.lineno)