Skip to content

AttributeError with attr.s(slots=True) #1079

@Liam-DeVoe

Description

@Liam-DeVoe

First - mypyc is really cool, thanks for maintaining it!

I've been looking at trying to compile Hypothesis under mypyc. In doing so I ran into the following under mypyc (mypy 1.14.1, python 3.12):

import attr

@attr.s(slots=True)
class A:
    ints: list[int] = attr.ib()

print(A(ints=[1]).ints) # AttributeError: attribute 'ints' of 'A' undefined

but dropping slots=True runs successfully.

I know that mypyc claims only partial support for attrs/dataclasses. I figure I can just drop slots=True in this case and rely on mypyc's auto-slots instead, but also thought that reporting this would be worthwhile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions