From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E29FE13888F for ; Tue, 6 Oct 2015 13:46:31 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1E1421C02A; Tue, 6 Oct 2015 13:46:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A91BE21C041 for ; Tue, 6 Oct 2015 13:46:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 65A73340B28 for ; Tue, 6 Oct 2015 13:46:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D433AAC1 for ; Tue, 6 Oct 2015 13:46:18 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1444103988.50994b728212ae42d3f16f7081d972aa405ac008.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/lock.py X-VCS-Directories: catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 50994b728212ae42d3f16f7081d972aa405ac008 X-VCS-Branch: master Date: Tue, 6 Oct 2015 13:46:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e5314c03-b1d9-4cf7-a3c0-bbbd774744e1 X-Archives-Hash: 323ace6b85e8becd8a96f16e5f924d8a commit: 50994b728212ae42d3f16f7081d972aa405ac008 Author: Mike Frysinger gentoo org> AuthorDate: Tue Oct 6 03:59:48 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Oct 6 03:59:48 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=50994b72 lock: rewrite delete_lock_from_path_list This code looks like it attempts to remove self.lockdir from the lock_dirs_in_use list, but it doesn't seem to quite work: - it uses "for x in lock_dirs_in_use", but then indexes lock_dirs_in_use via the "i" variable - the "i" variable is set to 0, but then never incremented (looks like due to incorrect indentation) - the only way an entry would be deleted is if it happened to be in the first location of the list In the end, this looks like an ad-hoc implementation of the list .remove builtin, so just delete the code and use that. catalyst/lock.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/catalyst/lock.py b/catalyst/lock.py index c031258..25d2aa2 100644 --- a/catalyst/lock.py +++ b/catalyst/lock.py @@ -57,15 +57,9 @@ class LockDir(object): self.hardlock_paths={} def delete_lock_from_path_list(self): - i=0 try: - if LockDir.lock_dirs_in_use: - for x in LockDir.lock_dirs_in_use: - if LockDir.lock_dirs_in_use[i] == self.lockdir: - del LockDir.lock_dirs_in_use[i] - break - i=i+1 - except AttributeError: + LockDir.lock_dirs_in_use.remove(self.lockdir) + except ValueError: pass def islocked(self):