mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00:00 
			
		
		
		
	utils/exec_control: Fix issue with once_per_instance decorator
				
					
				
			Previously the `once_per_instance` used the output of `__repr__` to identify the class of where the decorated method was called from. For classes that override this method to produce the same output for different instances of the same class this caused different instances to be mistakenly treated as one. Now use the hash of the containing class instead of the string representation and update the tests to catch this error.
This commit is contained in:
		| @@ -57,7 +57,7 @@ def once_per_instance(method): | ||||
|     def wrapper(*args, **kwargs): | ||||
|         if __active_environment is None: | ||||
|             activate_environment('default') | ||||
|         func_id = repr(method.__hash__()) + repr(args[0]) | ||||
|         func_id = repr(method.__hash__()) + repr(args[0].__hash__()) | ||||
|         if func_id in __environments[__active_environment]: | ||||
|             return | ||||
|         else: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user