summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-03-16 13:21:33 +0100
committerXavier Claessens <xclaesse@gmail.com>2021-03-16 09:32:57 -0400
commit32e49b5ff20bf2868330aa6985a65b3e9323ebd5 (patch)
tree4a4dafeae0980f50026226adc1c605abc9682583
parent598e968993da58c89f773dc732c708a54b0ec8db (diff)
downloadmeson-32e49b5ff20bf2868330aa6985a65b3e9323ebd5.tar.gz
coredata: be more robust on unpickling errors
When reverting from 0.57 to 0.56, one can see an error like this: File /Users/pm215/src/qemu-for-merges/meson/mesonbuild/coredata.py, line 1016, in load obj = pickle.load(f) ModuleNotFoundError: No module named 'mesonbuild.mesonlib.universal'; 'mesonbuild.mesonlib' is not a package FAILED: build.ninja The reason is that the old version fails to resolve mesonbuild.mesonlib, which is a similar situation to the existing AttributeError check. Raise a MesonException for ModuleNotFoundError as well, so that reconfiguration proceeds using cmd_line.txt.
-rw-r--r--mesonbuild/coredata.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 01a29c249..aa8379430 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -943,7 +943,7 @@ def load(build_dir: str) -> CoreData:
obj = pickle.load(f)
except (pickle.UnpicklingError, EOFError):
raise MesonException(load_fail_msg)
- except AttributeError:
+ except (ModuleNotFoundError, AttributeError):
raise MesonException(
"Coredata file {!r} references functions or classes that don't "
"exist. This probably means that it was generated with an old "