aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-10-22 10:12:17 -0400
committerPatrick Griffis <tingping@tingping.se>2016-11-06 00:01:36 -0400
commit1811f83e2a53c973dc5e96c09d7a80971d9ca2c7 (patch)
treeaa55b5e09993008ef0a9a51a188a1a020d72f7d3
parentd37bbef41163d211cf5e80628d15c4d03690e183 (diff)
downloadmeson-1811f83e2a53c973dc5e96c09d7a80971d9ca2c7.zip
meson-1811f83e2a53c973dc5e96c09d7a80971d9ca2c7.tar.gz
meson-1811f83e2a53c973dc5e96c09d7a80971d9ca2c7.tar.bz2
Don't expose module functions prefixed with _
This is the common Python convention for private methods so lets not expose these to build files as they are implementation details and their behavior is undefined.
-rw-r--r--mesonbuild/interpreter.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 3044d51..e01c54d 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -981,6 +981,8 @@ class ModuleHolder(InterpreterObject):
fn = getattr(self.held_object, method_name)
except AttributeError:
raise InvalidArguments('Module %s does not have method %s.' % (self.modname, method_name))
+ if method_name.startswith('_'):
+ raise InvalidArguments('Function {!r} in module {!r} is private.'.format(method_name, self.modname))
state = ModuleState()
state.build_to_src = os.path.relpath(self.interpreter.environment.get_source_dir(),
self.interpreter.environment.get_build_dir())