diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-01-21 12:27:09 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-01-23 17:21:53 -0500 |
commit | 4f40962a05aae3881327ec04c02396153e5aa318 (patch) | |
tree | c08b585dd87c66cd20aaeb6c0a5454fdb2bcd849 /mesonbuild/interpreter/interpreterobjects.py | |
parent | a00ede432f9c090d7e32331ee33d134f4bba478e (diff) | |
download | meson-4f40962a05aae3881327ec04c02396153e5aa318.zip meson-4f40962a05aae3881327ec04c02396153e5aa318.tar.gz meson-4f40962a05aae3881327ec04c02396153e5aa318.tar.bz2 |
interpreterobjects: Don't warn on set10(bool)
Python inherited a really bad design from C, booleans happen to be ints.
Which is awful, but it's true.
Fixes: #9858
Diffstat (limited to 'mesonbuild/interpreter/interpreterobjects.py')
-rw-r--r-- | mesonbuild/interpreter/interpreterobjects.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py index 9560221..2656f14 100644 --- a/mesonbuild/interpreter/interpreterobjects.py +++ b/mesonbuild/interpreter/interpreterobjects.py @@ -320,7 +320,10 @@ class ConfigurationDataHolder(ObjectHolder[build.ConfigurationData], MutableInte @typed_kwargs('configuration_data.set10', _CONF_DATA_SET_KWS) def set10_method(self, args: T.Tuple[str, T.Union[int, bool]], kwargs: 'kwargs.ConfigurationDataSet') -> None: self.__check_used() - if isinstance(args[1], int): + # bool is a subclass of int, so we need to check for bool excplicitly. + # We already have typed_pos_args checking that this is either a bool or + # an int. + if not isinstance(args[1], bool): mlog.deprecation('configuration_data.set10 with number. the `set10` ' 'method should only be used with booleans', location=self.interpreter.current_node) |