Skip to content

"Already defined" + "not defined" errors with SQLAlchemy 1.2 hybrid_property #4430

Closed
@Deimos

Description

@Deimos

SQLAlchemy 1.2 was recently released, and changed its behavior of hybrid_property a bit to line up with how Python's @property works. Specifically, it's now necessary to use the same method name for both the getter and setter, as seen in the example here (both are def name(...)): http://docs.sqlalchemy.org/en/latest/changelog/migration_12.html#hybrid-attributes-support-reuse-among-subclasses-redefinition-of-getter

This is causing mypy to error though, it now emits two (contradictory?) errors on the @name.setter line:

test.py:11: error: Name 'name' already defined
test.py:11: error: Name 'name' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-descriptorsProperties, class vs. instance attributes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions