Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c08cf0

Browse files
committed
Fix '_set_command_options()' so it only calls 'strtobool()' on strings
(was crashing on any boolean command-line option!).
1 parent 81467b8 commit 2c08cf0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/distutils/dist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,10 @@ def _set_command_options (self, command_obj, option_dict=None):
755755
neg_opt = {}
756756

757757
try:
758-
if neg_opt.has_key(option):
758+
is_string = type(value) is StringType
759+
if neg_opt.has_key(option) and is_string:
759760
setattr(command_obj, neg_opt[option], not strtobool(value))
760-
elif option in bool_opts:
761+
elif option in bool_opts and is_string:
761762
setattr(command_obj, option, strtobool(value))
762763
elif hasattr(command_obj, option):
763764
setattr(command_obj, option, value)

0 commit comments

Comments
 (0)