mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Fix '_set_command_options()' so it only calls 'strtobool()' on strings
(was crashing on any boolean command-line option!).
This commit is contained in:
		
							parent
							
								
									81467b8146
								
							
						
					
					
						commit
						2c08cf0ffa
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -755,9 +755,10 @@ def _set_command_options (self, command_obj, option_dict=None):
 | 
				
			||||||
                neg_opt = {}
 | 
					                neg_opt = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try:
 | 
					            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))
 | 
					                    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))
 | 
					                    setattr(command_obj, option, strtobool(value))
 | 
				
			||||||
                elif hasattr(command_obj, option):
 | 
					                elif hasattr(command_obj, option):
 | 
				
			||||||
                    setattr(command_obj, option, value)
 | 
					                    setattr(command_obj, option, value)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue