src/pyams_utils/decorator.py
changeset 95 f6cc362670a6
parent 1 3f89629b9e54
child 292 b338586588ad
--- a/src/pyams_utils/decorator.py	Mon Jun 19 16:05:08 2017 +0200
+++ b/src/pyams_utils/decorator.py	Mon Jun 19 16:24:22 2017 +0200
@@ -23,9 +23,9 @@
 
 
 def deprecated(*msg):
-    """This is a decorator which can be used to mark functions
-    as deprecated. It will result in a warning being emitted
-    when the function is used.
+    """This is a decorator which can be used to mark functions as deprecated.
+
+    It will result in a warning being emitted when the function is used.
     """
 
     def decorator(func):
@@ -34,8 +34,8 @@
         def new_func(*args, **kwargs):
             warnings.warn_explicit("Function %s is deprecated. %s" % (func.__name__, message),
                                    category=DeprecationWarning,
-                                   filename=func.func_code.co_filename,
-                                   lineno=func.func_code.co_firstlineno + 1)
+                                   filename=func.__code__.co_filename,
+                                   lineno=func.__code__.co_firstlineno + 1)
             return func(*args, **kwargs)
         return new_func