Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
bpo-35951: os.renames() creates directories if original name doesn't exist #11827
vstinner left a comment
IMHO the doc becomes outdated by your change, and should be rephrased:
I also suggest to add a ".. versionchanged:: x.y (...)" to os.renames() doc.
Since the current surprising behavior is documented, I suggest to only make the change in Python 3.8 and not backport it. So the doc note would be ".. versionchanged:: 3.8 (...)".
I would also prefer to document the change at https://docs.python.org/dev/whatsnew/3.8.html#changes-in-the-python-api since it's "somehow" backward incompatible (feature or bugfix? hard to say here :-)).
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase
@vstinner I replied on BPO.
Unrelated, while I'm here. I'm taking a look at test_os.py and I would like to add more tests for fs-related os functions (it appears they're kinda lacking). Also feel free to CC me in filesystem related issues (e.g. os, shutil modules). Thanks.
@giampaolo thanks for insight on tests. I dint catch that at all :)
I am working on tests for os.renames() I opened an issue to track that here : https://bugs.python.org/issue35982.
IMHO, I think we need to improve the current behavior.
The discussion on the BPO is not conclusive. You pointed out that this fix makes the problem a lot less likely to occur but we may end up with a race condition.
Can we close this PR so that maybe someone comes with a fix that addresses both problems? can we work with this fix? Am happy to comply with any decision. cc @vstinner
Once we agree on this, I will make necessary changes also in the review of this PR.