mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	Merge pull request #3503 from Glandos/patch-2
Don't try to hash value if enum is empty
This commit is contained in:
		
						commit
						14b1321c42
					
				|  | @ -29,7 +29,10 @@ class TagInfo(namedtuple("_TagInfo", "value name type length enum")): | ||||||
|             cls, value, name, type, length, enum or {}) |             cls, value, name, type, length, enum or {}) | ||||||
| 
 | 
 | ||||||
|     def cvt_enum(self, value): |     def cvt_enum(self, value): | ||||||
|         return self.enum.get(value, value) |         # Using get will call hash(value), which can be expensive | ||||||
|  |         # for some types (e.g. Fraction). Since self.enum is rarely | ||||||
|  |         # used, it's usually better to test it first. | ||||||
|  |         return self.enum.get(value, value) if self.enum else value | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def lookup(tag): | def lookup(tag): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user