mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	don't try to hash value if enum is empty
Very few tags have an enum, and for those who don't, computing the hash value can be very expensive, e.g. instances of `fractions.Fraction` as mentioned in [the source](https://github.com/python/cpython/blob/master/Lib/fractions.py#L543).
This commit is contained in:
		
							parent
							
								
									9dd0348be2
								
							
						
					
					
						commit
						e37b3fb7d3
					
				| 
						 | 
				
			
			@ -29,7 +29,7 @@ class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
 | 
			
		|||
            cls, value, name, type, length, enum or {})
 | 
			
		||||
 | 
			
		||||
    def cvt_enum(self, value):
 | 
			
		||||
        return self.enum.get(value, value)
 | 
			
		||||
        return self.enum.get(value, value) if self.enum else value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def lookup(tag):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user