diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-04-25 14:47:37 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-19 18:31:37 -0400 |
commit | 7afc69254d6b7240406cb1112ab57355bd9d32cd (patch) | |
tree | 6246648038a69ba8e3ce48841eeb37bcad00e7d9 /mesonbuild/interpreterbase | |
parent | cfc3960956f98aff74b118ce3de89a40ef3496c1 (diff) | |
download | meson-7afc69254d6b7240406cb1112ab57355bd9d32cd.zip meson-7afc69254d6b7240406cb1112ab57355bd9d32cd.tar.gz meson-7afc69254d6b7240406cb1112ab57355bd9d32cd.tar.bz2 |
fix implicit_reexport issues and enforce them going forward
This detects cases where module A imports a function from B, and C
imports that same function from A instead of B. It's not part of the API
contract of A, and causes innocent refactoring to break things.
Diffstat (limited to 'mesonbuild/interpreterbase')
-rw-r--r-- | mesonbuild/interpreterbase/decorators.py | 3 | ||||
-rw-r--r-- | mesonbuild/interpreterbase/interpreterbase.py | 15 |
2 files changed, 8 insertions, 10 deletions
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py index 64e02c2..10683fd 100644 --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -29,8 +29,7 @@ if T.TYPE_CHECKING: from typing_extensions import Protocol from .. import mparser - from .baseobjects import InterpreterObject, TV_func, TYPE_var, TYPE_kwargs - from .interpreterbase import SubProject + from .baseobjects import InterpreterObject, SubProject, TV_func, TYPE_var, TYPE_kwargs from .operator import MesonOperator _TV_IntegerObject = T.TypeVar('_TV_IntegerObject', bound=InterpreterObject, contravariant=True) diff --git a/mesonbuild/interpreterbase/interpreterbase.py b/mesonbuild/interpreterbase/interpreterbase.py index 5f854d0..d039f6d 100644 --- a/mesonbuild/interpreterbase/interpreterbase.py +++ b/mesonbuild/interpreterbase/interpreterbase.py @@ -36,7 +36,6 @@ from .exceptions import ( InterpreterException, InvalidArguments, InvalidCode, - MesonException, SubdirDoneRequest, ) @@ -319,12 +318,12 @@ class InterpreterBase: def evaluate_comparison(self, node: mparser.ComparisonNode) -> InterpreterObject: val1 = self.evaluate_statement(node.left) if val1 is None: - raise MesonException('Cannot compare a void statement on the left-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the left-hand side') if isinstance(val1, Disabler): return val1 val2 = self.evaluate_statement(node.right) if val2 is None: - raise MesonException('Cannot compare a void statement on the right-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the right-hand side') if isinstance(val2, Disabler): return val2 @@ -350,7 +349,7 @@ class InterpreterBase: def evaluate_andstatement(self, cur: mparser.AndNode) -> InterpreterObject: l = self.evaluate_statement(cur.left) if l is None: - raise MesonException('Cannot compare a void statement on the left-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the left-hand side') if isinstance(l, Disabler): return l l_bool = l.operator_call(MesonOperator.BOOL, None) @@ -358,7 +357,7 @@ class InterpreterBase: return self._holderify(l_bool) r = self.evaluate_statement(cur.right) if r is None: - raise MesonException('Cannot compare a void statement on the right-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the right-hand side') if isinstance(r, Disabler): return r return self._holderify(r.operator_call(MesonOperator.BOOL, None)) @@ -366,7 +365,7 @@ class InterpreterBase: def evaluate_orstatement(self, cur: mparser.OrNode) -> InterpreterObject: l = self.evaluate_statement(cur.left) if l is None: - raise MesonException('Cannot compare a void statement on the left-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the left-hand side') if isinstance(l, Disabler): return l l_bool = l.operator_call(MesonOperator.BOOL, None) @@ -374,7 +373,7 @@ class InterpreterBase: return self._holderify(l_bool) r = self.evaluate_statement(cur.right) if r is None: - raise MesonException('Cannot compare a void statement on the right-hand side') + raise mesonlib.MesonException('Cannot compare a void statement on the right-hand side') if isinstance(r, Disabler): return r return self._holderify(r.operator_call(MesonOperator.BOOL, None)) @@ -413,7 +412,7 @@ class InterpreterBase: assert isinstance(node, mparser.TernaryNode) result = self.evaluate_statement(node.condition) if result is None: - raise MesonException('Cannot use a void statement as condition for ternary operator.') + raise mesonlib.MesonException('Cannot use a void statement as condition for ternary operator.') if isinstance(result, Disabler): return result result.current_node = node |