python: Fix deprecated decorator
The deprecation message was firing during the decoration process instead of firing upon first call to deprecated function. The message now fires only if the deprected function is called. Change-Id: I2d510eb24884fdba0123e71e8472db68ae9d2ce4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67334 Maintainer: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Richard Cooper <richard.cooper@arm.com>
This commit is contained in:
committed by
Gabriel B.
parent
8110a42266
commit
8d0fde1961
@@ -108,8 +108,12 @@ def deprecated(replacement=None, logger=warn):
|
||||
message += f" Prefer {replacement} instead."
|
||||
logger(message)
|
||||
|
||||
notifyDeprecation()
|
||||
return func
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
notifyDeprecation()
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
Reference in New Issue
Block a user