Skip to content

PTH104 suggests Path.rename() which does not support file descriptors #17694

@sbrudenell

Description

@sbrudenell

Summary

import os
os.rename("src", "dst", src_dir_fd=3, dst_dir_fd=4)
$ ruff --version
ruff 0.11.7
$ ruff check --isolated --select PTH104 t.py
t.py:2:1: PTH104 `os.rename()` should be replaced by `Path.rename()`
  |
1 | import os
2 | os.rename("src", "dst", src_dir_fd=3, dst_dir_fd=4)
  | ^^^^^^^^^ PTH104
  |

Found 1 error.

Path.rename() has no support for dir_fd arguments.

Related: #17693, #12871, #7620

Version

0.11.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions especially welcomeruleImplementing 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