Skip to content

Commit ea66026

Browse files
committed
is_disabler: do not flatten positional args
1 parent 39ebb85 commit ea66026

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

docs/yaml/functions/is_disabler.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: is_disabler
22
returns: bool
33
since: 0.52.0
4-
description: Returns true if a variable is a disabler and false otherwise.
4+
description: |
5+
Returns true if a variable is a disabler and false otherwise.
6+
7+
Since 1.10.0, if the argument is a list, it returns false even if an element of
8+
the list is a disabler.
59
610
posargs:
711
var:

mesonbuild/interpreter/interpreter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3589,7 +3589,10 @@ def machine_from_native_kwarg(kwargs: T.Dict[str, T.Any]) -> MachineChoice:
35893589
@FeatureNew('is_disabler', '0.52.0')
35903590
@typed_pos_args('is_disabler', object)
35913591
@noKwargs
3592+
@noArgsFlattening
35923593
def func_is_disabler(self, node: mparser.BaseNode, args: T.Tuple[object], kwargs: 'TYPE_kwargs') -> bool:
3594+
if isinstance(args[0], list):
3595+
FeatureNew.single_use('is_disabler with list argument', '1.10.0', self.subproject, location=node)
35933596
return isinstance(args[0], Disabler)
35943597

35953598
@noKwargs

test cases/common/158 disabler/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,6 @@ foreach k, i : {'a': true, 'b': disabler(), 'c': true}
151151
endforeach
152152
assert(loops == 3, 'Disabler in foreach dict')
153153
assert(disablers == 1, 'Disabler in foreach dict')
154+
155+
array = [1, disabler(), 3]
156+
assert(not is_disabler(array))

0 commit comments

Comments
 (0)