Skip to content

PTH123 suggests Path.open() which does not support file descriptors #12871

@sbrudenell

Description

@sbrudenell
fp = open(2)
$ ruff --version
ruff 0.5.7
$ ruff check --isolated --select PTH123 t.py
t.py:1:6: PTH123 `open()` should be replaced by `Path.open()`
  |
1 | fp = open(2)
  |      ^^^^ PTH123
  |

Found 1 error.

Path.open() doesn't seem to have a variant which supports a file descriptor.

This is essentially similar to #7620

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions