Closed
Description
Summary
fp = open(1)
def f() -> int:
return 1
fp = open(f())
def g(x: int) -> None:
open(x)
r = 1
fp = open(r)
$ ruff --version
ruff 0.11.7
$ ruff check --isolated --select PTH123 t.py
t.py:4:6: PTH123 `open()` should be replaced by `Path.open()`
|
2 | def f() -> int:
3 | return 1
4 | fp = open(f())
| ^^^^ PTH123
5 | def g(x: int) -> None:
6 | open(x)
|
Found 1 error.
This doesn't look like a regression of #12871. But I guess the fix (#13616) somehow didn't cover the case where the argument of open()
is an int
return value?
Version
0.11.7