summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--documentation.py9
-rw-r--r--documentation3.py4
-rw-r--r--src/decorator.py2
3 files changed, 7 insertions, 8 deletions
diff --git a/documentation.py b/documentation.py
index 1548b5c..0aab054 100644
--- a/documentation.py
+++ b/documentation.py
@@ -780,9 +780,8 @@ you will get a ``NameError``:
Finally, the implementation is such that the decorated function
attribute ``.func_globals`` is a *copy* of the original function
-attribute. On the other hand the function attribute dictionary
-of the decorated function is just a reference to the
-original function dictionary, i.e. ``vars(decorated_f) is vars(f)``:
+attribute, just as thee attribute dictionary
+of the decorated function.
.. code-block:: python
@@ -795,8 +794,8 @@ original function dictionary, i.e. ``vars(decorated_f) is vars(f)``:
>>> traced_f.attr1
'something'
>>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did change
- 'something different'
+ >>> f.attr2 # the original attribute did not change
+ 'something else'
Compatibility notes
---------------------------------------------------------------
diff --git a/documentation3.py b/documentation3.py
index 5be0cca..92adac8 100644
--- a/documentation3.py
+++ b/documentation3.py
@@ -788,8 +788,8 @@ the original function dictionary:
>>> traced_f.attr1
'something'
>>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did change, works in Python 3.4
- 'something different'
+ >>> f.attr2 # the original attribute did not change
+ 'something else'
Compatibility notes
---------------------------------------------------------------
diff --git a/src/decorator.py b/src/decorator.py
index 4ed7247..ece2488 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -111,7 +111,7 @@ class FunctionMaker(object):
allshortargs.append('**' + self.varkw)
self.signature = ', '.join(allargs)
self.shortsignature = ', '.join(allshortargs)
- self.dict = func.__dict__
+ self.dict = func.__dict__.copy()
# func=None happens when decorating a caller
if name:
self.name = name