[issue45545] chdir __exit__ is not safe

Filipe Laíns report at bugs.python.org
Mon Oct 25 20:15:33 EDT 2021


Filipe Laíns <lains at riseup.net> added the comment:

Alternatively, can't we just os.chdir(self._old_cwd) in __enter__ and preemptively fail? IMO it's probably better to just straight up fail if we can chdir back to the original directory than to have relatively fragile recovery logic.

----------

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


More information about the Python-bugs-list mailing list