Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AttributeError 'did you mean' suggestions don't appear for properties without a setter #130399

Open
@cfbolz

Description

@cfbolz

Bug report

Bug description:

class A:
    @property
    def computed_a(self):
        return 2

    @property
    def computed_b(self):
        return 3
    @computed_b.setter
    def computed_b(self, val):
        print('set!')

a = A()
a.computed_a = 12 # typo

When running this, I would expect to get AttributeError: ... Did you mean: 'computed_b', but I'm not getting a suggestion. I think it's because the AttributeError that property.__set__ raises doesn't have .obj and .name set.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions