[issue40278] pathlib Path.replace raises OSError when target exists

Michael Selik report at bugs.python.org
Tue Apr 14 00:45:59 EDT 2020


Michael Selik <mike at selik.org> added the comment:

The docs for ``os.replace`` says "If dst is a directory, OSError will be raised."  That's helpful, but the docs for ``pathlib.Path.replace`` make it seem like the target will be unconditionally replaced regardless of whether it's a file or directory.  Sure, there's the association of the two functions in the correspondence table in the pathlib docs, but that's easy to overlook when looking up ``pathlib.Path.replace``.

If nothing else, I guess this is a request to alter the docstring.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40278>
_______________________________________


More information about the Python-bugs-list mailing list