New submission from Oz Tiram <nahu...@gmail.com>:
Pathlib.rename will fail across file system with: OSError: [Errno 18] Invalid cross-device link e.g: -> path_dict["current_path"].rename(path_dict["destination"]) (Pdb) n OSError: [Errno 18] Invalid cross-device link: '/tmp/pipenv-k1m0oynt-yaml/PyYAML-6.0/lib/yaml' -> '/home/oz123/Software/pipenv/pipenv/patched/yaml3' This is because it uses os.rename under the hood: https://github.com/python/cpython/blob/3.10/Lib/pathlib.py#L306 One can either replace it with `shutil.move` which works, or one could add another method to Pathlib.move(...) with similar signature and return value, which calls `shutil.move` under the hood. Before submitting a patch for that, I would like to get feedback for that. ---------- components: Library (Lib) messages: 410155 nosy: Oz.Tiram priority: normal severity: normal status: open title: Pathlib.rename isn't robust versions: Python 3.10, Python 3.11, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46317> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com