Author: Simon Cross <[email protected]>
Branch: 
Changeset: r64009:c7ed613a458c
Date: 2013-04-16 21:07 +0200
http://bitbucket.org/pypy/pypy/changeset/c7ed613a458c/

Log:    Add support for func_doc/__doc__ to interpindirect2app.

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -812,6 +812,7 @@
     exec func_code.compile() in d
     f = d['f']
     f.func_defaults = unbound_meth.func_defaults
+    f.func_doc = unbound_meth.func_doc
     f.__module__ = func.__module__
     # necessary for unique identifiers for pickling
     f.func_name = func.func_name
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -138,6 +138,7 @@
 
         class BaseA(W_Root):
             def method(self, space, x):
+                "This is a method"
                 pass
 
             def method_with_default(self, space, x=5):
@@ -173,6 +174,9 @@
         assert space.int_w(space.call_function(w_c, w_a, space.wrap(1))) == 1 
+ 2
         assert space.int_w(space.call_function(w_c, w_b, space.wrap(-10))) == 
-10 + 1
 
+        doc = space.str_w(space.getattr(w_c, space.wrap('__doc__')))
+        assert doc == "This is a method"
+
         meth_with_default = gateway.interpindirect2app(
             BaseA.method_with_default, {'x': int})
         w_d = space.wrap(meth_with_default)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to