From: Ian Jackson Subject: Re: [PATCH] tools/pygrub: Fix error handling if no valid partitions are found Date: Mon, 12 May 2014 15:53:33 +0100 Message-ID: <21360.57453.201011.542667@mariner.uk.xensource.com> References: <536D6EF2.9020603@gmail.com> <1399684713-22736-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1399684713-22736-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Sven Kohler , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("[PATCH] tools/pygrub: Fix error handling if no valid partitions are found"): > If no partitions at all are found, pygrub never creates the name 'fs', > resulting in a NameError indicating the lack of fs, rather than a > RuntimeError explaining that no partitions were found. > > Set fs to None right at the start, and use the pythonic idiom "if fs is None:" > to protect against otherwise valid values for fs which compare equal to > 0/False. Acked-by: Ian Jackson Committed-by: Ian Jackson Thanks, Ian.