-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-32903: Fix a memory leak in os.chdir() on Windows #5801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Should I create a bug report for such simple fixes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. But I suggest removing the empty lines to keep code style consistent. And it's better to return True
instead of return result
in UNC condition. Also, add a NEWs entry please.
GetCurrentDirectory() can't return non-normalized paths.
@zhangyangyu Thank you for reviewing! I've removed the empty lines and also realized that checking for
Do you mean that |
@izbyshev , No, I mean before when it's a UNC path, |
Actually, there must never be any difference, otherwise it is a bug (if |
The function is declared to return |
@zhangyangyu I totally misunderstood your point, sorry. I thought you were arguing that If you worry about somebody using |
Don't change the signature plz. Just add another check to let it return |
… like that" This reverts commit 239d77e.
@zhangyangyu Done! |
@izbyshev Seems you can't remove the check for And the code would be more explicit if you still use |
@zhangyangyu If you want to go deeper, the original |
Regarding |
Okay. But I would suggest changing the checks by a new issue if you are sure and asking our Windows gurus to decide, I really can't decide on that since I don't Windows :-(. Leave this issue only about the memory issue.
Why? if |
I wanted to take the opportunity to perform a minor cleanup by changing path checks since it doesn't distract from this small issue. But if you insist, I can revert the changes and use the original checks.
If you care about explicit code, the type of |
Sorry for much bikeshedding. But believe me it's not a good idea to do the cleanup in this issue. Feel free to open a new issue to push that. Of course, thanks for this contribution! |
Thank you for reviewing. I don't think it's worth opening a new issue for cleanup since the checks are correct, they are just a bit less clean and optimal than they could be. |
Thanks @izbyshev for the PR, and @zhangyangyu for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7. |
(cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
GH-5945 is a backport of this pull request to the 3.7 branch. |
Sorry, @izbyshev and @zhangyangyu, I could not cleanly backport this to |
GH-5946 is a backport of this pull request to the 3.6 branch. |
(cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
…-5801). (cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
GH-5947 is a backport of this pull request to the 2.7 branch. |
#5947) (cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
(cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
…python#5946) (cherry picked from commit 3e197c7) Co-authored-by: Alexey Izbyshev <[email protected]>
https://bugs.python.org/issue32903