mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	[3.9] bpo-39728: Enum: fix duplicate ValueError (GH-22277) (GH-22282)
				
					
				
			fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
(cherry picked from commit c95ad7a91f)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
			
			
This commit is contained in:
		
							parent
							
								
									4465df6266
								
							
						
					
					
						commit
						a9ba8ba9a7
					
				
					 4 changed files with 21 additions and 2 deletions
				
			
		|  | @ -628,7 +628,7 @@ def _generate_next_value_(name, start, count, last_values): | |||
| 
 | ||||
|     @classmethod | ||||
|     def _missing_(cls, value): | ||||
|         raise ValueError("%r is not a valid %s" % (value, cls.__qualname__)) | ||||
|         return None | ||||
| 
 | ||||
|     def __repr__(self): | ||||
|         return "<%s.%s: %r>" % ( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ethan Furman
						Ethan Furman