From 455147db016c3509c55ef644a5e8a6d3b1f2674e 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bugbear.py b/bugbear.py index 873fc10..de0fa40 100644 --- a/bugbear.py +++ b/bugbear.py @@ -124,9 +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): try: