New submission from Pablo Galindo Salgado <[email protected]>:
Consider this code:
class A:
__slots__ = [
"_color",
]
color = None
@property
def color(self):
return self._color
A().color
Executing this shows:
Traceback (most recent call last):
File "/Users/pgalindo3/lel.py", line 21, in <module>
A().color
File "/Users/pgalindo3/lel.py", line 18, in color
return self._color
AttributeError: 'A' object has no attribute '_color'. Did you mean: '_color'?
This is because the nested getattr call of "@property" overrides the metadata
information in the exception object and it tries to produce an error message
for the attribute "color" instead of "_color".
----------
assignee: pablogsal
messages: 414623
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Suggestion messages don't properly work in nested getattr calls
versions: Python 3.10, Python 3.11
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46940>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com