diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2024-04-09 09:53:48 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2024-04-09 12:27:39 -0700 |
commit | d6a0b7a6ecde30d44fb1960866385d8f5a6e30f3 (patch) | |
tree | b4464535d82d8f8578555368cdcd3bf6d77beb84 | |
parent | d617dc6869bcd5afcd784ff39cc5b6597b1912a2 (diff) | |
download | meson-d6a0b7a6ecde30d44fb1960866385d8f5a6e30f3.zip meson-d6a0b7a6ecde30d44fb1960866385d8f5a6e30f3.tar.gz meson-d6a0b7a6ecde30d44fb1960866385d8f5a6e30f3.tar.bz2 |
interpreter: never expose implementation details of the modules package
When a user writes `import'foo')`, Meson checks the
`mesonbuild/modules/` directory for a package called `foo.py`, and
attempts to import it. We don't want to expose any implementation detail
packages like `_qt.py`, so if someone write `import('_qt')`, we should
immediately give a "doesn't exist" error.
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 6e38c57..de8f24d 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -608,6 +608,10 @@ class Interpreter(InterpreterBase, HoldableObject): if disabled: return NotFoundExtensionModule(modname) + # Always report implementation detail modules don't exist + if modname.startswith('_'): + raise InvalidArguments(f'Module "{modname}" does not exist') + expect_unstable = False # Some tests use "unstable_" instead of "unstable-", and that happens to work because # of implementation details |