[pypy-svn] r12211 - pypy/dist/pypy/annotation
pedronis at codespeak.net
pedronis at codespeak.net
Thu May 12 13:15:51 CEST 2005
Author: pedronis
Date: Thu May 12 13:15:50 2005
New Revision: 12211
Modified:
pypy/dist/pypy/annotation/bookkeeper.py
Log:
valueoftype impl for low-level types
Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py (original)
+++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 12 13:15:50 2005
@@ -15,6 +15,7 @@
from pypy.interpreter.pycode import cpython_code_signature
from pypy.interpreter.argument import ArgErr
from pypy.rpython.rarithmetic import r_uint
+from pypy.rpython import lltypes
from pypy.tool.unionfind import UnionFind
import inspect, new
@@ -144,6 +145,8 @@
values_s = [self.immutablevalue(e) for e in x.values()]
result = SomeDict(DictDef(self, unionof(*keys_s),
unionof(*values_s)))
+ elif isinstance(x, lltypes.LowLevelType):
+ result = ll_to_annotation(x._example())
elif ishashable(x) and x in BUILTIN_ANALYZERS:
result = SomeBuiltin(BUILTIN_ANALYZERS[x])
elif callable(x) or isinstance(x, staticmethod): # XXX
@@ -206,6 +209,8 @@
def valueoftype(self, t):
"""The most precise SomeValue instance that contains all
objects of type t."""
+ if isinstance(t, lltypes.LowLevelType):
+ return ll_to_annotation(t._example())
assert isinstance(t, (type, ClassType))
if t is bool:
return SomeBool()
@@ -221,7 +226,7 @@
return SomeList(MOST_GENERAL_LISTDEF)
elif t is dict:
return SomeDict(MOST_GENERAL_DICTDEF)
- # can't do dict, tuple
+ # can't do tuple
elif t.__module__ != '__builtin__':
classdef = self.getclassdef(t)
return SomeInstance(classdef)
More information about the Pypy-commit
mailing list