Author: Ronan Lamy <[email protected]>
Branch: var-in-Some
Changeset: r71557:6ff2b5fd1e02
Date: 2014-05-17 03:01 +0100
http://bitbucket.org/pypy/pypy/changeset/6ff2b5fd1e02/

Log:    register annotator for op.type; kill one use of the
        _find_current_op() hack

diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -19,18 +19,14 @@
 UNARY_OPERATIONS = set([oper.opname for oper in op.__dict__.values()
                         if oper.dispatch == 1])
 
[email protected](SomeObject)
+def type(arg):
+    r = SomeType()
+    r.is_type_of = [arg.value]
+    return r
 
 class __extend__(SomeObject):
 
-    def type(self, *moreargs):
-        if moreargs:
-            raise Exception('type() called with more than one argument')
-        r = SomeType()
-        bk = getbookkeeper()
-        op = bk._find_current_op(opname="type", arity=1, pos=0, s_type=self)
-        r.is_type_of = [op.args[0]]
-        return r
-
     def issubtype(self, s_cls):
         if hasattr(self, 'is_type_of'):
             vars = self.is_type_of
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to