diff --git a/mesonbuild/interpreterbase/interpreterbase.py b/mesonbuild/interpreterbase/interpreterbase.py index 525d5d6c54a0..cbfe97a3afa6 100644 --- a/mesonbuild/interpreterbase/interpreterbase.py +++ b/mesonbuild/interpreterbase/interpreterbase.py @@ -543,7 +543,7 @@ def method_call(self, node: mparser.MethodNode) -> T.Optional[InterpreterObject] method_name = node.name.value (h_args, h_kwargs) = self.reduce_arguments(node.args) (args, kwargs) = self._unholder_args(h_args, h_kwargs) - if is_disabled(args, kwargs): + if is_disabled(args, kwargs) and method_name != 'get_variable': return Disabler() if not isinstance(obj, InterpreterObject): raise InvalidArguments(f'{object_display_name} is not callable.') diff --git a/test cases/common/280 subproject get_variable disabler/meson.build b/test cases/common/280 subproject get_variable disabler/meson.build new file mode 100644 index 000000000000..820b9f939a0d --- /dev/null +++ b/test cases/common/280 subproject get_variable disabler/meson.build @@ -0,0 +1,11 @@ +# https://github.com/mesonbuild/meson/issues/13717 + +project('foo', 'c') + +bar_subproj = subproject('bar') +bar_dep = bar_subproj.get_variable('bar_dep', disabler()) + +if is_disabler(bar_dep) + error('bar_dep is a disabler') +endif + diff --git a/test cases/common/280 subproject get_variable disabler/subprojects/bar/meson.build b/test cases/common/280 subproject get_variable disabler/subprojects/bar/meson.build new file mode 100644 index 000000000000..c23a7f1e0f9e --- /dev/null +++ b/test cases/common/280 subproject get_variable disabler/subprojects/bar/meson.build @@ -0,0 +1,2 @@ +project('bar', 'c') +bar_dep = declare_dependency()