Modify ↓
#10809 closed defect (fixed)
AttributeError raises at Storage.__del__ if invalid location as git repository
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | version control | Version: | 1.0dev |
Severity: | minor | Keywords: | git |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When I configured with invalid location as git repository, tracd
output the following to the console.
Exception AttributeError: "'Storage' object has no attribute '_Storage__cat_file_pipe_lock'" in <bound method Storage.__del__ of <tracopt.versioncontrol.git.PyGIT.Storage object at 0xb0d318c>> ignored
It would be good to move the instance variables initialization to intro of __init__
.
-
tracopt/versioncontrol/git/PyGIT.py
diff --git a/tracopt/versioncontrol/git/PyGIT.py b/tracopt/versioncontrol/git/PyGIT.py index f29eddc..523a1f0 100644
a b class Storage(object): 357 357 358 358 self.logger = log 359 359 360 self.commit_encoding = None 361 362 # caches 363 self.__rev_cache = None 364 self.__rev_cache_lock = Lock() 365 366 # cache the last 200 commit messages 367 self.__commit_msg_cache = SizedDict(200) 368 self.__commit_msg_lock = Lock() 369 370 self.__cat_file_pipe = None 371 self.__cat_file_pipe_lock = Lock() 372 360 373 if git_fs_encoding is not None: 361 374 # validate encoding name 362 375 codecs.lookup(git_fs_encoding) … … class Storage(object): 381 394 raise GitError("GIT control files not found, maybe wrong " 382 395 "directory?") 383 396 384 self.logger.debug("PyGIT.Storage instance %d constructed" % id(self))385 386 397 self.repo = GitCore(git_dir, git_bin=git_bin) 387 398 388 self.commit_encoding = None 389 390 # caches 391 self.__rev_cache = None 392 self.__rev_cache_lock = Lock() 393 394 # cache the last 200 commit messages 395 self.__commit_msg_cache = SizedDict(200) 396 self.__commit_msg_lock = Lock() 397 398 self.__cat_file_pipe = None 399 self.__cat_file_pipe_lock = Lock() 399 self.logger.debug("PyGIT.Storage instance %d constructed" % id(self)) 400 400 401 401 def __del__(self): 402 402 with self.__cat_file_pipe_lock:
Attachments (0)
Change History (3)
comment:1 by , 12 years ago
Severity: | normal → minor |
---|
comment:3 by , 12 years ago
Owner: | set to |
---|
Note:
See TracTickets
for help on using tickets.
This indeed makes the Exception go away. Feel free to commit!