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

Commit1ddf953

Browse files
committed
Fix TemporaryFileSwap bug when file_path is a Path
This fixes the regression introduced in9e86053 (#1770) where thefile_path argument to TemporaryFileSwap.__init__ could no longer bea Path object.The change also makes this truer to the code from before#1770,still without the race condition fixed there, in that str wascalled on file_path then as well. However, it is not clear thatthis is a good thing, because this is not an idiomatic use ofmkstemp. The reason the `prefix` cannot be a Path is that it isexpected to be a filename prefix, with leading directories given inthe `dir` argument.
1 parent487a4fd commit1ddf953

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎git/index/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TemporaryFileSwap:
4141

4242
def__init__(self,file_path:PathLike)->None:
4343
self.file_path=file_path
44-
fd,self.tmp_file_path=tempfile.mkstemp(prefix=self.file_path,dir="")
44+
fd,self.tmp_file_path=tempfile.mkstemp(prefix=str(self.file_path),dir="")
4545
os.close(fd)
4646
withcontextlib.suppress(OSError):# It may be that the source does not exist.
4747
os.replace(self.file_path,self.tmp_file_path)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp