mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #34209 -- Prevented FileBasedCache.has_key() crash caused by a race condition.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							1d0fa848e0
						
					
				
				
					commit
					32268456d6
				
			
							
								
								
									
										5
									
								
								django/core/cache/backends/filebased.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								django/core/cache/backends/filebased.py
									
									
									
									
										vendored
									
									
								
							| @@ -90,10 +90,11 @@ class FileBasedCache(BaseCache): | ||||
|  | ||||
|     def has_key(self, key, version=None): | ||||
|         fname = self._key_to_file(key, version) | ||||
|         if os.path.exists(fname): | ||||
|         try: | ||||
|             with open(fname, "rb") as f: | ||||
|                 return not self._is_expired(f) | ||||
|         return False | ||||
|         except FileNotFoundError: | ||||
|             return False | ||||
|  | ||||
|     def _cull(self): | ||||
|         """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user