[pypy-commit] pypy reflex-support: doc-strings for global functions
wlav
noreply at buildbot.pypy.org
Wed Apr 25 00:44:31 CEST 2012
Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r54741:2162bc565f20
Date: 2012-04-24 13:39 -0700
http://bitbucket.org/pypy/pypy/changeset/2162bc565f20/
Log: doc-strings for global functions
diff --git a/pypy/module/cppyy/pythonify.py b/pypy/module/cppyy/pythonify.py
--- a/pypy/module/cppyy/pythonify.py
+++ b/pypy/module/cppyy/pythonify.py
@@ -52,6 +52,7 @@
def function(*args):
return cppol.call(None, *args)
function.__name__ = func_name
+ function.__doc__ = cppol.signature()
return staticmethod(function)
def make_method(meth_name, cppol):
diff --git a/pypy/module/cppyy/test/fragile.cxx b/pypy/module/cppyy/test/fragile.cxx
--- a/pypy/module/cppyy/test/fragile.cxx
+++ b/pypy/module/cppyy/test/fragile.cxx
@@ -5,3 +5,7 @@
}
fragile::I fragile::gI;
+
+void fragile::fglobal(int, double, char) {
+ /* empty; only used for doc-string testing */
+}
diff --git a/pypy/module/cppyy/test/fragile.h b/pypy/module/cppyy/test/fragile.h
--- a/pypy/module/cppyy/test/fragile.h
+++ b/pypy/module/cppyy/test/fragile.h
@@ -75,4 +75,6 @@
int method1(int, double) { return 0; }
};
+void fglobal(int, double, char);
+
} // namespace fragile
diff --git a/pypy/module/cppyy/test/fragile.xml b/pypy/module/cppyy/test/fragile.xml
--- a/pypy/module/cppyy/test/fragile.xml
+++ b/pypy/module/cppyy/test/fragile.xml
@@ -6,4 +6,6 @@
<variable name="fragile::gI" />
+ <function pattern="fragile::f*" />
+
</lcgdict>
diff --git a/pypy/module/cppyy/test/fragile_LinkDef.h b/pypy/module/cppyy/test/fragile_LinkDef.h
--- a/pypy/module/cppyy/test/fragile_LinkDef.h
+++ b/pypy/module/cppyy/test/fragile_LinkDef.h
@@ -19,4 +19,6 @@
#pragma link C++ variable fragile::gI;
+#pragma link C++ function fragile::fglobal;
+
#endif
diff --git a/pypy/module/cppyy/test/test_fragile.py b/pypy/module/cppyy/test/test_fragile.py
--- a/pypy/module/cppyy/test/test_fragile.py
+++ b/pypy/module/cppyy/test/test_fragile.py
@@ -191,3 +191,6 @@
j = fragile.J()
assert fragile.J.method1.__doc__ == j.method1.__doc__
assert j.method1.__doc__ == "int fragile::J::method1(int, double)"
+
+ f = fragile.fglobal
+ assert f.__doc__ == "void fragile::fglobal(int, double, char)"
More information about the pypy-commit
mailing list