◐ Shell
clean mode source ↗

bpo-25625: add contextlib.chdir by FFY00 · Pull Request #28271 · python/cpython

This is probably the single snippet of code I find myself re-implementing the
most in projects. Not being thread safe is not optimal, but there isn't
really any good way to do so, and that does not negate the huge
usefulness of this function.

Signed-off-by: Filipe Laíns <lains@riseup.net>

kalvdans

ambv

@ambv

ambv

@ambv

kalvdans

FFY00

Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>

serhiy-storchaka

Signed-off-by: Filipe Laíns <lains@riseup.net>

tiran

@tiran tiran mentioned this pull request

Sep 15, 2021

serhiy-storchaka

@ambv

Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>

warsaw

graingert

jcfr added a commit to jcfr/Slicer that referenced this pull request

Apr 29, 2022
This commit implements a non thread-safe context manager to change
the current working directory.

Available in Python 3.11 as ``contextlib.chdir`` and adapted from
python/cpython#28271.

@jcfr jcfr mentioned this pull request

Apr 29, 2022

jcfr added a commit to Slicer/Slicer that referenced this pull request

Apr 29, 2022
This commit implements a non thread-safe context manager to change
the current working directory.

Available in Python 3.11 as ``contextlib.chdir`` and adapted from
python/cpython#28271.