From e3c52130add2ed5f7f0b9442b3b2742c09eb2de0 Mon Sep 17 00:00:00 2001 From: Noman Arshad Date: Tue, 4 Aug 2020 23:39:28 +0500 Subject: MAINT: Chain exception in ``distutils/fcompiler/environment.py``. (#16962) Fixup exception chaining and more detailed exception message Co-authored-by: Eric Wieser Co-authored-by: Ross Barnowski --- numpy/distutils/fcompiler/environment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'numpy/distutils/fcompiler/environment.py') diff --git a/numpy/distutils/fcompiler/environment.py b/numpy/distutils/fcompiler/environment.py index 21a5be003..ecd4d9989 100644 --- a/numpy/distutils/fcompiler/environment.py +++ b/numpy/distutils/fcompiler/environment.py @@ -33,7 +33,10 @@ class EnvironmentConfig: try: conf_desc = self._conf_keys[name] except KeyError: - raise AttributeError(name) + raise AttributeError( + f"'EnvironmentConfig' object has no attribute '{name}'" + ) from None + return self._get_var(name, conf_desc) def get(self, name, default=None): -- cgit v1.2.1