-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Add Python 3.10 support #763
Conversation
""" | ||
String annotations are passed into __init__ as is. | ||
|
||
It fails on 3.6 due to a bug in Python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: Forward references must evaluate to types. Got typing.ClassVar[int].
@@ -487,10 +518,6 @@ class C: | |||
y = attr.ib(type=str) | |||
z = attr.ib() | |||
|
|||
assert "int" == attr.fields(C).x.type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they don't work across Python versions (they become typing.ForwardRef or something like that). I figured it's more important it ultimately gives us what we need?
@@ -624,9 +624,8 @@ def test_init(self, slots, frozen): | |||
with pytest.raises(TypeError) as e: | |||
C(a=1, b=2) | |||
|
|||
assert ( | |||
assert e.value.args[0].endswith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. What does it start with now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class names. So in this case C.
.
The tests have totally finished and succeeded. sigh |
0d5ecdc
to
939742f
Compare
Python 3.10 has string types everywhere and that has unmasked a bunch of bugs/edge cases in our code. Especially the hooks code need a resolving helper for string types. I'm leaving that for a separate PR. Fixes #716
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
Python 3.10 has string types everywhere and that has unmasked a bunch of
bugs/edge cases in our code.
Especially the hooks code need a resolving helper for string types. I'm leaving
that for a separate PR.
Same for test_mypy.yml
Fixes #716
cc @euresti @ambv @frenzymadness @sscherfke