Commit 41974b8
committed
gh-108411: Make typing.IO/BinaryIO arguments positional-only
`IO` is purported to be the type of the file objects returned by `open`.
However, all methods on those objects take positional-only arguments, while
`IO`'s methods are declared with regular arguments. As such, the file objects
cannot actually be considered to implement `IO`. The same thing applies to
`BinaryIO`.
Fix this by adjusting the definition of these ABCs to match the file objects.
This is technically a breaking change, but it is unlikely to actually break
anything:
* These methods should never be called at runtime, since they are abstract.
Therefore, this should not cause any runtime errors.
* In typeshed these arguments are already positional-only, so this should
not cause any errors during typechecking either.1 parent 4345253 commit 41974b8
File tree
2 files changed
+11
-9
lines changed- Lib
- Misc/NEWS.d/next/Library
2 files changed
+11
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3524 | 3524 | | |
3525 | 3525 | | |
3526 | 3526 | | |
3527 | | - | |
| 3527 | + | |
3528 | 3528 | | |
3529 | 3529 | | |
3530 | 3530 | | |
3531 | 3531 | | |
3532 | 3532 | | |
3533 | 3533 | | |
3534 | 3534 | | |
3535 | | - | |
| 3535 | + | |
3536 | 3536 | | |
3537 | 3537 | | |
3538 | 3538 | | |
3539 | | - | |
| 3539 | + | |
3540 | 3540 | | |
3541 | 3541 | | |
3542 | 3542 | | |
3543 | | - | |
| 3543 | + | |
3544 | 3544 | | |
3545 | 3545 | | |
3546 | 3546 | | |
| |||
3552 | 3552 | | |
3553 | 3553 | | |
3554 | 3554 | | |
3555 | | - | |
| 3555 | + | |
3556 | 3556 | | |
3557 | 3557 | | |
3558 | 3558 | | |
3559 | 3559 | | |
3560 | 3560 | | |
3561 | 3561 | | |
3562 | 3562 | | |
3563 | | - | |
| 3563 | + | |
3564 | 3564 | | |
3565 | 3565 | | |
3566 | 3566 | | |
3567 | | - | |
| 3567 | + | |
3568 | 3568 | | |
3569 | 3569 | | |
3570 | 3570 | | |
3571 | 3571 | | |
3572 | 3572 | | |
3573 | 3573 | | |
3574 | 3574 | | |
3575 | | - | |
| 3575 | + | |
3576 | 3576 | | |
3577 | 3577 | | |
3578 | 3578 | | |
| |||
3582 | 3582 | | |
3583 | 3583 | | |
3584 | 3584 | | |
3585 | | - | |
| 3585 | + | |
3586 | 3586 | | |
3587 | 3587 | | |
3588 | 3588 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments