Commit ec3a92f
committed
stubtest: don't flag __class_getitem__ as missing on a generic stub
A class that implements `__class_getitem__` at runtime to support
subscription is correctly modelled in a stub by declaring the class as
generic (PEP 695 `class C[T]` or `Generic[T]`). stubtest nevertheless
reported `C.__class_getitem__ is not present in stub` in that case.
Skip the `__class_getitem__` runtime member when the stub class is generic
(`TypeInfo.is_generic()`) and does not explicitly declare it. Non-generic
stubs still report the missing method as before.
Fixes #212531 parent 4c8f994 commit ec3a92f
2 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
710 | 720 | | |
711 | 721 | | |
712 | 722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
295 | 322 | | |
296 | 323 | | |
297 | 324 | | |
| |||
0 commit comments