summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase/interpreterbase.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-01-08 13:09:25 +0100
committerEli Schwartz <eschwartz93@gmail.com>2025-01-08 13:45:26 -0500
commitff5b5e66c9a759573af5f265a3404c3a144489de (patch)
treea66c6f9a43b0e8958260edb5c571dd4eb4185da9 /mesonbuild/interpreterbase/interpreterbase.py
parenta3679a64eec7c312c81d657880f34f015426c7db (diff)
downloadmeson-ff5b5e66c9a759573af5f265a3404c3a144489de.tar.gz
optimize variable assignments
Except for set_variable(), the variable name is certainly an identifier because it comes from the parser; thus, the check is unnecessary. Move the regular expression match to func_set_variable(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/interpreterbase/interpreterbase.py')
-rw-r--r--mesonbuild/interpreterbase/interpreterbase.py2
1 files changed, 0 insertions, 2 deletions
diff --git a/mesonbuild/interpreterbase/interpreterbase.py b/mesonbuild/interpreterbase/interpreterbase.py
index 5f9df4cb5..5849e9ca9 100644
--- a/mesonbuild/interpreterbase/interpreterbase.py
+++ b/mesonbuild/interpreterbase/interpreterbase.py
@@ -655,8 +655,6 @@ class InterpreterBase:
raise mesonlib.MesonBugException(f'set_variable in InterpreterBase called with a non InterpreterObject {variable} of type {type(variable).__name__}')
if not isinstance(varname, str):
raise InvalidCode('First argument to set_variable must be a string.')
- if re.match('[_a-zA-Z][_0-9a-zA-Z]*$', varname) is None:
- raise InvalidCode('Invalid variable name: ' + varname)
if varname in self.builtin:
raise InvalidCode(f'Tried to overwrite internal variable "{varname}"')
self.variables[varname] = variable