[pypy-svn] r28216 - in pypy/dist/pypy/translator: c tool
tismer at codespeak.net
tismer at codespeak.net
Sun Jun 4 11:12:52 CEST 2006
Author: tismer
Date: Sun Jun 4 11:12:51 2006
New Revision: 28216
Modified:
pypy/dist/pypy/translator/c/pyobj.py
pypy/dist/pypy/translator/tool/raymond.py
Log:
some stuff left over from the NFS sprint. Still to do: order exposed methods
dynamically depending on the existance of annotation
Modified: pypy/dist/pypy/translator/c/pyobj.py
==============================================================================
--- pypy/dist/pypy/translator/c/pyobj.py (original)
+++ pypy/dist/pypy/translator/c/pyobj.py Sun Jun 4 11:12:51 2006
@@ -7,7 +7,7 @@
from pypy.translator.gensupp import builtin_base, builtin_type_base
from pypy.translator.c.support import log
from pypy.translator.c.wrapper import gen_wrapper, new_method_graph
-from pypy.translator.tool.raymond import should_expose_method
+from pypy.translator.tool.raymond import should_expose
from pypy.rpython.rarithmetic import r_int, r_uint
from pypy.rpython.lltypesystem.lltype import pyobjectptr, LowLevelType
Modified: pypy/dist/pypy/translator/tool/raymond.py
==============================================================================
--- pypy/dist/pypy/translator/tool/raymond.py (original)
+++ pypy/dist/pypy/translator/tool/raymond.py Sun Jun 4 11:12:51 2006
@@ -51,10 +51,13 @@
ret = [thetype or cls for thetype in pattern]
return ret
-def should_expose_method(func):
+def should_expose(func):
# expose all special methods but hide those starting with _
name = func.__name__
- return name in SPECIAL_METHODS or not name.startswith('_')
+ return name in SPECIAL_METHODS or not name.startswith('_') or must_expose(func)
+
+def must_expose(func):
+ return hasattr(func, '_initialannotation_')
def get_compiled_module(func, view=conftest.option.view, inline_threshold=1,
use_boehm=False, exports=None, expose_all=True):
@@ -85,7 +88,7 @@
rtyper.add_wrapper(clsdef)
for obj in cls.__dict__.values():
if isinstance(obj, types.FunctionType):
- if should_expose_method(obj) and expose_all:
+ if should_expose(obj) and expose_all or must_expose(obj):
if not ann.bookkeeper.getdesc(obj).querycallfamily():
# not annotated, so enforce it
ann.build_types(obj, get_annotation(obj, [cls]), complete_now=False)
More information about the Pypy-commit
mailing list