@@ -13,7 +13,6 @@ class GuardedBase(ABC):
1313 linkage.
1414 """
1515
16- # 5b: Use class-level diagnoser
1716 _diagnoser = Diagnostics ()
1817
1918 def __init__ (self ):
@@ -30,7 +29,7 @@ def __getattr__(self, key: str):
3029 allowed = cls ._public_attrs ()
3130 if key not in allowed :
3231 type (self )._diagnoser .attr_error (
33- self .unique_name ,
32+ self ._log_name ,
3433 key ,
3534 allowed ,
3635 label = 'Allowed readable/writable' ,
@@ -50,7 +49,7 @@ def __setattr__(self, key: str, value):
5049 # Prevent modification of read-only attributes
5150 if key in cls ._public_readonly_attrs ():
5251 cls ._diagnoser .readonly_error (
53- self .unique_name ,
52+ self ._log_name ,
5453 key ,
5554 )
5655 return
@@ -59,7 +58,7 @@ def __setattr__(self, key: str, value):
5958 if key not in cls ._public_attrs ():
6059 allowed = cls ._public_writable_attrs ()
6160 cls ._diagnoser .attr_error (
62- self .unique_name ,
61+ self ._log_name ,
6362 key ,
6463 allowed ,
6564 label = 'Allowed writable' ,
@@ -112,7 +111,7 @@ def _allowed_attrs(self, writable_only=False):
112111
113112 @property
114113 def _log_name (self ):
115- return type (self ).__name__
114+ return self . unique_name or type (self ).__name__
116115
117116 @property
118117 def unique_name (self ):
0 commit comments