Skip to content

Commit 22b8dba

Browse files
committed
Improve git.util.cwd docstring
This frames the reentrancy claim in terms of what is similar to and different from contextlib.chdir (which we would just use, but it is only available on Python 3.11 and later).
1 parent a59aaea commit 22b8dba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: git/util.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ def wrapper(self: "Remote", *args: Any, **kwargs: Any) -> T:
150150

151151
@contextlib.contextmanager
152152
def cwd(new_dir: PathLike) -> Generator[PathLike, None, None]:
153-
"""Context manager to temporarily change directory. Not reentrant."""
153+
"""Context manager to temporarily change directory.
154+
155+
This is similar to contextlib.chdir introduced in Python 3.11, but the context
156+
manager object returned by a single call to this function is not reentrant."""
154157
old_dir = os.getcwd()
155158
os.chdir(new_dir)
156159
try:

0 commit comments

Comments
 (0)