From: Ian Jackson Subject: Re: [PATCH] tools/pygrub: Fix error handling if no valid partitions are found Date: Thu, 22 May 2014 16:50:46 +0100 Message-ID: <21374.7382.693922.174164@mariner.uk.xensource.com> References: <536D6EF2.9020603@gmail.com> <1399684713-22736-1-git-send-email-andrew.cooper3@citrix.com> <21360.57453.201011.542667@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21360.57453.201011.542667@mariner.uk.xensource.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 , Xen-devel , Sven Kohler , Ian Campbell List-Id: xen-devel@lists.xenproject.org Ian Jackson writes ("Re: [PATCH] tools/pygrub: Fix error handling if no valid partitions are found"): > 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 Backported to 4.4, 4.3, 4.2. Will push shortly. Ian.