[pypy-svn] r36732 - in pypy/dist/pypy/rpython: . test

fijal at codespeak.net fijal at codespeak.net
Sun Jan 14 14:15:04 CET 2007


Author: fijal
Date: Sun Jan 14 14:15:02 2007
New Revision: 36732

Modified:
   pypy/dist/pypy/rpython/extfunc.py
   pypy/dist/pypy/rpython/test/test_extfunc.py
Log:
Minor change and a test for something else, which passes.


Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py	(original)
+++ pypy/dist/pypy/rpython/extfunc.py	Sun Jan 14 14:15:02 2007
@@ -64,4 +64,7 @@
         if ooimpl:
             ootypeimpl = ooimpl
 
-    FunEntry.__name__ = export_name
+    if export_name:
+        FunEntry.__name__ = export_name
+    else:
+        FunEntry.__name__ = function.func_name

Modified: pypy/dist/pypy/rpython/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/rpython/test/test_extfunc.py	Sun Jan 14 14:15:02 2007
@@ -1,5 +1,5 @@
 
-from pypy.rpython.extfunc import ExtFuncEntry
+from pypy.rpython.extfunc import ExtFuncEntry, _callable, register_external
 from pypy.annotation import model as annmodel
 from pypy.annotation.annrpython import RPythonAnnotator
 from pypy.annotation.policy import AnnotatorPolicy
@@ -73,3 +73,18 @@
     s = a.build_types(f, [])
     assert isinstance(s, annmodel.SomeFloat)
     assert a.translator._graphof(callback)
+
+def dd():
+    pass
+
+register_external(dd, [int], int)
+
+def test_register_external_signature():
+    def f():
+        return dd(3)
+
+    policy = AnnotatorPolicy()
+    policy.allow_someobjects = False
+    a = RPythonAnnotator(policy=policy)
+    s = a.build_types(f, [])
+    assert isinstance(s, annmodel.SomeInteger)



More information about the Pypy-commit mailing list