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
os.chdir in unittest's test case causes RecursionError on Windows #90145
Comments
When I was writing unit tests, I noticed that os.chdir in the unittest test case failed with RecursionError. It seems to work fine on Ubuntu 20.04, but fails on Windows 10 (might fail on macOS). The attached file is a minimal code to reproduce this. When I run it, I got an error message as follows
The version of python was: Regards, |
What is (snip)? |
Windows opens the working directory without delete sharing, so trying to delete it fails with a PermissionError for ERROR_SHARING_VIOLATION (winerror 32). I discussed a modified version of the _rmtree() method in msg377358. The proposed version would try to reset the permissions in the first pass, recur once, and then give up because the permission error cannot be handled. |
Sorry, the "(snip)" means that it was omitted because it was too long. |
Thank you, eryksun, for pointing out the cause of the problem. I have modified the test script and it can now be run on Windows. The attached file is a revised version of the reproduction script, which reflects the modifications made to the test script to prevent the error. |
I think it may be difficult to understand the error message that deleting a directory causes "RecursionError or stack overflow", though. I hope the issue reported as msg377358 will be resolved in some way. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: