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

Commit2c7fce0

Browse files
committed
Remove obsolete note in _iter_packed_refs
This removes a comment noting that a try-finally block had beenpresent (or had been intended), but was removed because someversion of Python had imposed a limitation on yield appearing intry-finally.That comment was obsolete as of58c5b99 (#326), which wrapped therelevant code in a with-statement, because:1. Since then, the cleanup is done in a manner equivaent to try-finally.2. It turned out, as noted in that PR, that cleanup had not always been done automatically. (This was contrary to the prediction given in the comment.)3. At some point before that, the limitation that had prevented the use of try-finally no longer affected any supported version of Python. Specifically, it appears the only limitation that this could be was the limitation lifted in Python 2.5, where along with the introduction of close(), which is automatically called when a generator object is finalized, it became permitted for yield to appear in a try-block with an associated finally-block, on the grounds that calling close() runs the finally-block (by raising GeneratorExit). For details, see:https://docs.python.org/3/whatsnew/2.5.html#pep-342-new-generator-features(This obsolete comment was one of the things I discovered whileworking on#1725, but I didn't include this change there, havingnot yet looked into the history of the code enough to be sure.)
1 parent1755b1d commit2c7fce0

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

‎git/refs/symbolic.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ def _iter_packed_refs(cls, repo: "Repo") -> Iterator[Tuple[str, str]]:
149149
exceptOSError:
150150
returnNone
151151
# END no packed-refs file handling
152-
# NOTE: Had try-finally block around here to close the fp,
153-
# but some python version wouldn't allow yields within that.
154-
# I believe files are closing themselves on destruction, so it is
155-
# alright.
156152

157153
@classmethod
158154
defdereference_recursive(cls,repo:"Repo",ref_path:Union[PathLike,None])->str:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp