Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22b8dba

Browse files
committed
Improve git.util.cwd docstring
This frames the reentrancy claim in terms of what is similar to anddifferent from contextlib.chdir (which we would just use, but it isonly available on Python 3.11 and later).
1 parenta59aaea commit22b8dba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎git/util.py

Lines changed: 4 additions & 1 deletion
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
defcwd(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)

[8]ページ先頭

©2009-2025 Movatter.jp