Commit 056c130
committed
[
Type default for Type parameter was added in Python 3.13 (PEP 696).
`typing_extensions.TypeVar` backports the default argument to earlier
versions.
`UP046` & `UP047` were getting triggered when typing_extensions.TypeVar
with `default` argument was used on python version < 3.13
It shouldn't be triggered for python version < 3.13
This commit fixes the bug by adding a python version check before
triggering them.
Fixes #20929.
Signed-off-by: Prakhar Pratyush <prakhar1144@gmail.com>pyupgrade] Fix false positive for TypeVar with default on Python<3.13 (UP046,UP047)1 parent 7198e53 commit 056c130
1 file changed
Lines changed: 9 additions & 5 deletions
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
373 | 375 | | |
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
377 | 379 | | |
378 | | - | |
| 380 | + | |
| 381 | + | |
379 | 382 | | |
380 | | - | |
| 383 | + | |
| 384 | + | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| |||
0 commit comments