From: Zac Medico Date: Fri, 22 Oct 2010 18:40:23 +0000 (-0700) Subject: AsynchronousLock: assert state in unlock() X-Git-Tag: v2.1.9.25~64 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3b30317dd566f6b5cdb3625e5746fd675e175736;p=portage.git AsynchronousLock: assert state in unlock() --- diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py index d72add4f1..53fbd22d2 100644 --- a/pym/_emerge/AsynchronousLock.py +++ b/pym/_emerge/AsynchronousLock.py @@ -126,6 +126,8 @@ class _LockThread(AbstractPollTask): def unlock(self): 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 @@ -217,6 +219,8 @@ class _LockProcess(AbstractPollTask): def unlock(self): if self._proc is None: raise AssertionError('not locked') + if self.returncode is None: + raise AssertionError('lock not acquired yet') self._files['pipe_out'].write(b'\0') self._files['pipe_out'].close() self._files = None