summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2024-02-08 10:15:37 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2024-02-19 21:52:09 +0200
commitb290a8254122f53d6477b7ba24366d81cfc5e99c (patch)
tree920bcdb68784a262736d387dbe38935d7df3c52f /mesonbuild/modules
parent43fe0061902f9d204eeeb8d4fef779480ec5487c (diff)
downloadmeson-b290a8254122f53d6477b7ba24366d81cfc5e99c.tar.gz
Fix KeyError in Python module
0e7fb07 introduced a subtile bug in the Python module. If a python version is found, but is missing a required module, it is added to the list of python installations, but the `run_bytecompile` attribute for that version was not initialized. Therefore, if any other python version added something to install, it was raising a KeyError when trying to read the `run_bytecompile` attribute for the python version with missing module.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/python.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 7a2cd2837..59b5050c0 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -74,6 +74,7 @@ class PythonExternalProgram(BasicPythonExternalProgram):
if ret:
self.platlib = self._get_path(state, 'platlib')
self.purelib = self._get_path(state, 'purelib')
+ self.run_bytecompile.setdefault(self.info['version'], False)
return ret
def _get_path(self, state: T.Optional['ModuleState'], key: str) -> str:
@@ -544,7 +545,6 @@ class PythonModule(ExtensionModule):
assert isinstance(python, PythonExternalProgram), 'for mypy'
python = copy.copy(python)
python.pure = kwargs['pure']
- python.run_bytecompile.setdefault(python.info['version'], False)
return python
raise mesonlib.MesonBugException('Unreachable code was reached (PythonModule.find_installation).')