summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-22 11:40:23 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-22 11:40:23 -0700
commit4e25ba1dd62fa23ccec3bc6d65ff5502a1ce955e (patch)
tree0f52221f4ee45e1f25663a8a12d7a929c2b52f5d
parent25262e2997ff92ec2ffdc17c2261c38fb04b6328 (diff)
downloadportage-4e25ba1dd62fa23ccec3bc6d65ff5502a1ce955e.tar.gz
portage-4e25ba1dd62fa23ccec3bc6d65ff5502a1ce955e.tar.bz2
portage-4e25ba1dd62fa23ccec3bc6d65ff5502a1ce955e.zip
AsynchronousLock: assert state in unlock()
-rw-r--r--pym/_emerge/AsynchronousLock.py4
1 files changed, 4 insertions, 0 deletions
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