Message384166
That makes sense, but I wonder what the "right" behaviour should be in this case. Surely the infinite recursion should be fixed at the very minimum. Perhaps the code on Windows could be enhanced to catch the case whereby one is trying to delete the cwd and do something like chdir('..') and then delete the temp folder. However, I suspect that something like this still wouldn't be enough. For example, this works fine
~~~ python
def test_chdir():
with tempfile.TemporaryDirectory() as tempdir:
old = os.getcwd()
os.chdir(tempdir)
os.chdir(old)
~~~
whereas this doesn't (same stacktrace as the original case)
~~~ python
def test_chdir():
with tempfile.TemporaryDirectory() as tempdir:
old = os.getcwd()
os.chdir(tempdir)
with open(os.path.join(tempdir, "delme")) as fout:
fout.write("Hello")
os.chdir(old)
~~~ |
|
Date |
User |
Action |
Args |
2021-01-01 13:34:49 | Gabriele Tornetta | set | recipients:
+ Gabriele Tornetta, christian.heimes |
2021-01-01 13:34:49 | Gabriele Tornetta | set | messageid: <1609508089.79.0.236161571076.issue42796@roundup.psfhosted.org> |
2021-01-01 13:34:49 | Gabriele Tornetta | link | issue42796 messages |
2021-01-01 13:34:49 | Gabriele Tornetta | create | |
|