Make _LockThread.lock_obj private.
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Oct 2010 18:44:00 +0000 (11:44 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Oct 2010 18:44:00 +0000 (11:44 -0700)
pym/_emerge/AsynchronousLock.py

index 53fbd22d22147ef9c02032f690d28f6c3edc7566..3fe0e9747eaa524460d5900b3af6cc861f5fbebf 100644 (file)
@@ -84,8 +84,8 @@ class _LockThread(AbstractPollTask):
        (before the start() method returns).
        """
 
-       __slots__ = ('lock_obj', 'path',) + \
-               ('_files', '_force_dummy',
+       __slots__ = ('path',) + \
+               ('_files', '_force_dummy', '_lock_obj',
                '_thread', '_reg_id',)
 
        def _start(self):
@@ -106,7 +106,7 @@ class _LockThread(AbstractPollTask):
                self._thread.start()
 
        def _run_lock(self):
-               self.lock_obj = lockfile(self.path, wantnewlockfile=True)
+               self._lock_obj = lockfile(self.path, wantnewlockfile=True)
                self._files['pipe_write'].write(b'\0')
 
        def _output_handler(self, f, event):
@@ -124,12 +124,12 @@ class _LockThread(AbstractPollTask):
                return self.returncode
 
        def unlock(self):
-               if self.lock_obj is None:
+               if self._lock_obj is None:
                        raise AssertionError('not locked')
                if self.returncode is None:
                        raise AssertionError('lock not acquired yet')
-               unlockfile(self.lock_obj)
-               self.lock_obj = None
+               unlockfile(self._lock_obj)
+               self._lock_obj = None
 
        def _unregister(self):
                self._registered = False