[pypy-svn] r7378 - pypy/trunk/src/pypy/annotation

mwh at codespeak.net mwh at codespeak.net
Thu Nov 18 15:36:02 CET 2004


Author: mwh
Date: Thu Nov 18 15:36:02 2004
New Revision: 7378

Modified:
   pypy/trunk/src/pypy/annotation/builtin.py
Log:
yadda yadda builtin_issubclass yadda yadda builtin_hasattr yadda

Pretty simplistic, improvements certainly possible.


Modified: pypy/trunk/src/pypy/annotation/builtin.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/builtin.py	(original)
+++ pypy/trunk/src/pypy/annotation/builtin.py	Thu Nov 18 15:36:02 2004
@@ -59,12 +59,24 @@
             return r
     return SomeBool()
 
+def builtin_issubclass(s_cls1, s_cls2):
+    if s_cls1.is_constant() and s_cls2.is_constant():
+        return immutablevalue(issubclass(s_cls1, s_cls2))
+    else:
+        return SomeBool()
+
 def builtin_getattr(s_obj, s_attr):
     if not s_attr.is_constant() or not isinstance(s_attr.const, str):
         raise Exception, 'getattr(%r, %r) is not RPythonic enough' % (
             s_obj, s_attr)
     return s_obj.getattr(s_attr)
 
+def builtin_hasattr(s_obj, s_attr):
+    if not s_attr.is_constant() or not isinstance(s_attr.const, str):
+        raise Exception, 'hasattr(%r, %r) is not RPythonic enough' % (
+            s_obj, s_attr)
+    return SomeBool()
+
 def builtin_tuple(s_iterable):
     if isinstance(s_iterable, SomeTuple):
         return s_iterable



More information about the Pypy-commit mailing list