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

Commite480985

Browse files
committed
Tweak rollback logic in log.to_file
This modifies the exception handling in log.to_file so it catchesBaseException rather than Exception and rolls back. Ordinarily wedo not want to catch BaseException, since this means catchingthings like SystemExit, KeyboardInterupt, etc., but the other casesof rolling back with LockedFD do it that strongly (both before whentry-finally was used with a flag, and now with try-except catchingBaseException to roll back the temporary-file write and reraise).Having this behave subtly different does not appear intentional.(This is also closer to what will happen if LockedFD becomes acontext manager and these pieces of code use it in awith-statement: even exceptions not inheriting from Exception willcause __exit__ to be called.)
1 parentff84b26 commite480985

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎git/refs/log.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ def to_file(self, filepath: PathLike) -> None:
262262
try:
263263
self._serialize(fp)
264264
lfd.commit()
265-
exceptException:
266-
# on failure it rolls back automatically, but we make it clear
265+
exceptBaseException:
267266
lfd.rollback()
268267
raise
269268
# END handle change

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp