Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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):  
    357357
    358358        self.logger = log
    359359
     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
    360373        if git_fs_encoding is not None:
    361374            # validate encoding name
    362375            codecs.lookup(git_fs_encoding)
    class Storage(object):  
    381394            raise GitError("GIT control files not found, maybe wrong "
    382395                           "directory?")
    383396
    384         self.logger.debug("PyGIT.Storage instance %d constructed" % id(self))
    385 
    386397        self.repo = GitCore(git_dir, git_bin=git_bin)
    387398
    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))
    400400
    401401    def __del__(self):
    402402        with self.__cat_file_pipe_lock:

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 9 years ago

Severity: normalminor

This indeed makes the Exception go away. Feel free to commit!

comment:2 by Jun Omae, 9 years ago

Resolution: fixed
Status: newclosed

Applied in [11217].

comment:3 by Jun Omae, 9 years ago

Owner: set to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.