From 856adfbe03ff897362303884e46cffd9eb88d8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Fri, 5 Mar 2021 18:20:52 +0100 Subject: [PATCH] add pass test --- bugbear.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bugbear.py b/bugbear.py index 873fc10..974e5cb 100644 --- a/bugbear.py +++ b/bugbear.py @@ -124,8 +124,10 @@ def _to_name_str(node): # "pkg.mod.error", handling any depth of attribute accesses. if isinstance(node, ast.Name): return node.id - assert isinstance(node, ast.Attribute) - return _to_name_str(node.value) + "." + node.attr + try: + return _to_name_str(node.value) + "." + node.attr + except AttributeError: + return _to_name_str(node.value) def _typesafe_issubclass(cls, class_or_tuple):