Gabriel B. has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/67334?usp=email )

Change subject: util-m5: Fix deprecated decorator
......................................................................

util-m5: 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
---
M src/python/m5/util/__init__.py
1 file changed, 19 insertions(+), 2 deletions(-)



diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index bc4ab4a..5ae4875 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -108,8 +108,12 @@
                     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


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/67334?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2d510eb24884fdba0123e71e8472db68ae9d2ce4
Gerrit-Change-Number: 67334
Gerrit-PatchSet: 1
Gerrit-Owner: Gabriel B. <gabriel.bus...@arteris.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to