[pypy-commit] pypy default: test and fix

jbs noreply at buildbot.pypy.org
Sun Jun 24 15:03:38 CEST 2012


Author: Jasper Schulz <jasper.schulz at student.hpi.uni-potsdam.de>
Branch: 
Changeset: r55797:10f5281aab40
Date: 2012-06-24 14:55 +0200
http://bitbucket.org/pypy/pypy/changeset/10f5281aab40/

Log:	test and fix

diff --git a/pypy/tool/sourcetools.py b/pypy/tool/sourcetools.py
--- a/pypy/tool/sourcetools.py
+++ b/pypy/tool/sourcetools.py
@@ -224,6 +224,7 @@
     if func.func_dict:
         f.func_dict = {}
         f.func_dict.update(func.func_dict)
+    f.func_doc = func.func_doc
     return f
 
 def func_renamer(newname):
diff --git a/pypy/tool/test/test_sourcetools.py b/pypy/tool/test/test_sourcetools.py
--- a/pypy/tool/test/test_sourcetools.py
+++ b/pypy/tool/test/test_sourcetools.py
@@ -22,3 +22,15 @@
     assert f.func_name == "g"
     assert f.func_defaults == (5,)
     assert f.prop is int
+
+def test_func_rename_decorator():
+    def bar():
+        'doc'
+
+    bar2 = func_with_new_name(bar, 'bar2')
+    assert bar.func_doc == bar2.func_doc == 'doc'
+
+    bar.func_doc = 'new doc'
+    bar3 = func_with_new_name(bar, 'bar3')
+    assert bar3.func_doc == 'new doc'
+    assert bar2.func_doc != bar3.func_doc


More information about the pypy-commit mailing list