-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bpo-34776: Fix dataclasses to support __future__ "annotations" mode #9518
Changes from 5 commits
39006fb
ebcbf69
32427a5
97df9b2
563dda4
8400415
e38de43
71ab405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from __future__ import annotations | ||
|
||
import dataclasses | ||
|
||
|
||
class Foo: | ||
pass | ||
|
||
|
||
@dataclasses.dataclass | ||
class Bar: | ||
foo: Foo |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix dataclasses to support __future__ "annotations" mode | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strictly speaking, this problem is not directly related to Here is an example that does not use PEP 563: from typing import get_type_hints
from dataclasses import dataclass
class T:
pass
@dataclass()
class C2:
x: 'T'
print(get_type_hints(C2.__init__)) Before your change:
After your change it works as expected:
|
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.
Note to self: add a comment explaining this.