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

Commit22a0289

Browse files
committed
Index: handling an AttributeError exception raised in python 2.6.5 and newer if an unset slot is being deleted.
1 parent0d6ceab commit22a0289

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎lib/git/index.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def clear_cache(func):
248248
"""
249249
defclear_cache_if_not_raised(self,*args,**kwargs):
250250
rval=func(self,*args,**kwargs)
251-
del(self.entries)
251+
self._delete_entries_cache()
252252
returnrval
253253

254254
# END wrapper method
@@ -345,6 +345,15 @@ def path(self):
345345
"""
346346
returnself._file_path
347347

348+
def_delete_entries_cache(self):
349+
"""Safely clear the entries cache so it can be recreated"""
350+
try:
351+
del(self.entries)
352+
exceptAttributeError:
353+
# fails in python 2.6.5 with this exception
354+
pass
355+
# END exception handling
356+
348357
@classmethod
349358
def_read_entry(cls,stream):
350359
"""Return: One entry of the given stream"""
@@ -774,7 +783,7 @@ def update(self):
774783
Returns
775784
self
776785
"""
777-
del(self.entries)
786+
self._delete_entries_cache()
778787
# allows to lazily reread on demand
779788
returnself
780789

@@ -937,7 +946,7 @@ def add(self, items, force=True, fprogress=lambda *args: None):
937946
self._flush_stdin_and_wait(proc,ignore_stdout=True)# ignore stdout
938947

939948
# force rereading our entries once it is all done
940-
del(self.entries)
949+
self._delete_entries_cache()
941950
entries_added.extend(self.entries[(f,0)]forfinadded_files)
942951
# END path handling
943952

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp