This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients FFY00, barry, eryksun, ucodery
Date 2021-10-26.05:37:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635226649.21.0.321508781.issue45545@roundup.psfhosted.org>
In-reply-to
Content
> Alternatively, can't we just os.chdir(self._old_cwd) in __enter__ and preemptively fail? 

If the context manager isn't going to address the long-path case reliably using either a file-descriptor approach or repeated relative chdir() calls, then I think failing early like this is the next best choice.

The previous directory getting deleted is a random environment error, which can be left up to the caller. In POSIX, it might be avoidable using a file-descriptor approach, but POSIX doesn't actually guarantee that fchdir() will succeed if the file descriptor refers to a deleted directory.
History
Date User Action Args
2021-10-26 05:37:29eryksunsetrecipients: + eryksun, barry, FFY00, ucodery
2021-10-26 05:37:29eryksunsetmessageid: <1635226649.21.0.321508781.issue45545@roundup.psfhosted.org>
2021-10-26 05:37:29eryksunlinkissue45545 messages
2021-10-26 05:37:29eryksuncreate