Return a disabler when an unknown method is called on a disabler object

pull/6256/head
James Hilliard 5 years ago committed by Nirbheek Chauhan
parent 49317784be
commit 45f0f3cdd0
  1. 5
      mesonbuild/interpreterbase.py
  2. 3
      test cases/common/163 disabler/meson.build

@ -803,8 +803,11 @@ The result of this is undefined and will become a hard error in a future Meson r
(args, kwargs) = self.reduce_arguments(args) (args, kwargs) = self.reduce_arguments(args)
# Special case. This is the only thing you can do with a disabler # Special case. This is the only thing you can do with a disabler
# object. Every other use immediately returns the disabler object. # object. Every other use immediately returns the disabler object.
if isinstance(obj, Disabler) and method_name == 'found': if isinstance(obj, Disabler):
if method_name == 'found':
return False return False
else:
return Disabler()
if is_disabled(args, kwargs): if is_disabled(args, kwargs):
return Disabler() return Disabler()
if method_name == 'extract_objects': if method_name == 'extract_objects':

@ -2,6 +2,9 @@ project('dolphin option', 'c')
d = disabler() d = disabler()
full_path = d.full_path()
assert(is_disabler(full_path), 'Method call is not a disabler')
d2 = dependency(d) d2 = dependency(d)
d3 = (d == d2) d3 = (d == d2)
d4 = d + 0 d4 = d + 0

Loading…
Cancel
Save