Commit 9d7a042
authored
[PEP 695] Fix covariance of frozen dataclasses (#17783)
Fix this conformance test:
```
@DataClass(frozen=True)
class ShouldBeCovariant4[T]:
x: T
vo4_1: ShouldBeCovariant4[float] = ShouldBeCovariant4[int](1) # OK
vo4_2: ShouldBeCovariant4[int] = ShouldBeCovariant4[float](1) # E
```
Link:
https://github.com/python/typing/blob/main/conformance/tests/generics_variance_inference.py#L661 parent fce14a0 commit 9d7a042
2 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2004 | 2004 | | |
2005 | 2005 | | |
2006 | 2006 | | |
2007 | | - | |
| 2007 | + | |
| 2008 | + | |
2008 | 2009 | | |
2009 | 2010 | | |
2010 | 2011 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
252 | 271 | | |
253 | 272 | | |
254 | 273 | | |
| |||
0 commit comments