commit: 8384c20cc1b33a31ff1e49e61a4547c109b0d8e4
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Jan 15 05:09:42 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 17 20:49:46 2023 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=8384c20c
fix(config): add exception chaining for an internal error.
This code was written before exception chaining, but it's esoteric
enough we very much want the chain to be thrown.
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcore/config/basics.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/pkgcore/config/basics.py b/src/pkgcore/config/basics.py
index 2bc3e1c9b..91e16dabf 100644
--- a/src/pkgcore/config/basics.py
+++ b/src/pkgcore/config/basics.py
@@ -86,13 +86,12 @@ class ConfigType:
if not getattr(hint_overrides, "authorative", None):
try:
code = getattr(func_obj, "__code__")
- except AttributeError:
+ except AttributeError as e:
if func_obj != object.__init__:
raise TypeError(
- "func %s has no %r attribute; likely a "
+ f"func {original_func_obj!r} isn't usable; likely a "
"builtin object which can't be introspected without
hints"
- % (original_func_obj, "__code__")
- )
+ ) from e
else:
if code.co_argcount and code.co_varnames[0] == "self":
args = code.co_varnames[1 : code.co_argcount]