Simon Cross avatar Simon Cross committed c7ed613

Add support for func_doc/__doc__ to interpindirect2app.

Comments (0)

Files changed (2)

pypy/interpreter/gateway.py

     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

pypy/interpreter/test/test_gateway.py

 
         class BaseA(W_Root):
             def method(self, space, x):
+                "This is a method"
                 pass
 
             def method_with_default(self, space, x=5):
         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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.