]> granicus.if.org Git - python/commitdiff
Fix '_set_command_options()' so it only calls 'strtobool()' on strings
authorGreg Ward <gward@python.net>
Wed, 27 Sep 2000 00:15:37 +0000 (00:15 +0000)
committerGreg Ward <gward@python.net>
Wed, 27 Sep 2000 00:15:37 +0000 (00:15 +0000)
(was crashing on any boolean command-line option!).

Lib/distutils/dist.py

index 91b820e9b4bd1b54958a5147f2abcd41461501d0..92d390f777c11ebf45bb38913c65fcc9d1006d30 100644 (file)
@@ -755,9 +755,10 @@ class Distribution:
                 neg_opt = {}
 
             try:
-                if neg_opt.has_key(option):
+                is_string = type(value) is StringType
+                if neg_opt.has_key(option) and is_string:
                     setattr(command_obj, neg_opt[option], not strtobool(value))
-                elif option in bool_opts:
+                elif option in bool_opts and is_string:
                     setattr(command_obj, option, strtobool(value))
                 elif hasattr(command_obj, option):
                     setattr(command_obj, option, value)