aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-03-16 13:21:33 +0100
committerNirbheek Chauhan <nirbheek@centricular.com>2021-04-04 00:06:04 +0530
commit9d1dfd548fd6f03c89efab415dd2b1dbee5a65ce (patch)
treeadbd67106534183aee7c3c5374f69c54ee503af2
parent6ffa815c05a7c2248939e60e039551879e706ce8 (diff)
downloadmeson-9d1dfd548fd6f03c89efab415dd2b1dbee5a65ce.zip
meson-9d1dfd548fd6f03c89efab415dd2b1dbee5a65ce.tar.gz
meson-9d1dfd548fd6f03c89efab415dd2b1dbee5a65ce.tar.bz2
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 669d72a..180448e 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 "