[issue35951] os.renames() creates directories if original name doesn't exist

Chris Jerdonek report at bugs.python.org
Tue Feb 12 18:57:07 EST 2019


Chris Jerdonek <chris.jerdonek at gmail.com> added the comment:

> As such the cleanup in case of failure should not be expected,

Given that the documentation specifically calls out permissions errors as a cause of leaving the new directory in place, it wouldn't be unreasonable for someone to think the function does a cleanup step on failure using the same pruning process on the target directory.

In fact, that scenario is the one scenario I can think of that makes how the note is written make sense -- the cleanup step not having permissions to remove the intermediate directories it just created ("This function can fail with the new directory structure made if you lack permissions needed to remove the leaf directory or file [just created]").

----------

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


More information about the Python-bugs-list mailing list