Closed
Description
When an exception is thrown the cleanup of Repo objects causes some very strange back traces.
When I run my test script several times. I have different results. Sometimes it works.
On other runs I have either the errors a), b) or c)
/work/GitPython/git/repo/base.py
def __del__(self):
self.close() # line 189
def close(self):
if self.git:
self.git.clear_cache()
gc.collect() # line 194
gitdb.util.mman.collect() # line 195
gc.collect()
a)
Exception ignored in: <bound method GitRepository.__del__ of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/work/GitPython/git/repo/base.py", line 189, in __del__
File "/work/GitPython/git/repo/base.py", line 195, in close
AttributeError: 'NoneType' object has no attribute 'mman'
b)
Exception ignored in: <bound method GitRepository.__del__ of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/work/GitPython/git/repo/base.py", line 189, in __del__
File "/work/GitPython/git/repo/base.py", line 194, in close
TypeError: 'NoneType' object is not callable
c)
Exception ignored in: <bound method GitRepository.__del__ of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/work/GitPython/git/repo/base.py", line 189, in __del__
File "/work/GitPython/git/repo/base.py", line 194, in close
AttributeError: 'NoneType' object has no attribute 'collect'
One solution to get rid of the back traces is to wrap the self.close() call in a try-except handler:
def __del__(self):
try:
self.close()
except:
pass
Metadata
Metadata
Assignees
Labels
No labels