Feature or enhancement
Some code paths format the attribute name with str() to format the AttributeError error message. Example:
>>> getattr(object(), "a'b")
AttributeError: 'object' object has no attribute 'a'b'
The quote character ' should be escaped in the error message ('a\'b'), or the attribute name should be quoted with " character ("a'b").
The expected error is:
AttributeError: 'object' object has no attribute "a'b"
I propose replacing str() with repr() to format the attribute name.
This issue is a follow-up of #153786 (comment) discussion (another AttributeError change).
Linked PRs
Feature or enhancement
Some code paths format the attribute name with str() to format the
AttributeErrorerror message. Example:The quote character
'should be escaped in the error message ('a\'b'), or the attribute name should be quoted with"character ("a'b").The expected error is:
I propose replacing str() with repr() to format the attribute name.
This issue is a follow-up of #153786 (comment) discussion (another AttributeError change).
Linked PRs