From ed0ad91f1cf4fa0fbc492a5c6259b74d45bd911e Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 16 Jan 2019 10:42:15 -0800 Subject: [PATCH] coredata: Handle AttributeError in unpickling coredata Which can happen due to internal refactorings, such as the removal of the ConfData class between 0.49 and 0.50 --- mesonbuild/coredata.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index d5f7d9497..ef16cae42 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -1,4 +1,4 @@ -# Copyright 2012-2018 The Meson development team +# Copyright 2012-2019 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -645,6 +645,11 @@ def load(build_dir): obj = pickle.load(f) except pickle.UnpicklingError: raise MesonException(load_fail_msg) + except AttributeError: + raise MesonException( + "Coredata file {!r} references functions or classes that don't " + "exist. This probably means that it was generated with an old " + "version of meson.".format(filename)) if not isinstance(obj, CoreData): raise MesonException(load_fail_msg) if obj.version != version: