Closed
Description
Bug report
object.__getattribute__
does not set name
and obj
of AttributeError
:
class Test: pass
test = Test()
try:
print("test.a")
test.a
except AttributeError as e:
print(f"{e=}")
print(f"{e.name=}")
print(f"{e.obj=}")
print()
try:
print('object.__getattribute__(test, "a")')
object.__getattribute__(test, "a")
except AttributeError as e:
print(f"{e=}")
print(f"{e.name=}")
print(f"{e.obj=}")
Output:
test.a
e=AttributeError("'Test' object has no attribute 'a'")
e.name='a'
e.obj=<__main__.Test object at 0x7f2fc87a8760>
object.__getattribute__(test, "a")
e=AttributeError("'Test' object has no attribute 'a'")
e.name=None
e.obj=None
- CPython versions tested on: Python 3.10.5, Python 3.12.0a0