Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tybug opened this issue Jan 2, 2025 · 1 comment · May be fixed by python/mypy#18447
Open

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

tybug opened this issue Jan 2, 2025 · 1 comment · May be fixed by python/mypy#18447

Comments

@tybug
Copy link

tybug commented Jan 2, 2025

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.

@tybug
Copy link
Author

tybug commented Jan 3, 2025

I guess this is a known limitation, though I had to look through mypy issues to find a mention of it: python/mypy#15274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant