From: Greg Ward Date: Tue, 23 May 2000 04:11:14 +0000 (+0000) Subject: Fix 'get_command_obj()' so it checks if a command object has an attribute X-Git-Tag: v2.0b1~1696 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40313cfe6ef09a47557e7c18f7f02622fe879158;p=thirdparty%2FPython%2Fcpython.git Fix 'get_command_obj()' so it checks if a command object has an attribute before setting it -- this will catch bad options (eg. typos) in config files. --- diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 3ceadf1985d1..7bdd9aa09b6c 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -627,6 +627,10 @@ class Distribution: print " setting options:" for (option, (source, value)) in options.items(): print " %s = %s (from %s)" % (option, value, source) + if not hasattr(cmd_obj, option): + raise DistutilsOptionError, \ + ("%s: command '%s' has no such option '%s'") % \ + (source, command, option) setattr(cmd_obj, option, value) return cmd_obj