[prev in list] [next in list] [prev in thread] [next in thread]
List: pypy-svn
Subject: [pypy-svn] r53209 - in
From: antocuni () codespeak ! net
Date: 2008-03-31 19:05:46
Message-ID: 20080331190546.D27E8168069 () codespeak ! net
[Download RAW message or body]
Author: antocuni
Date: Mon Mar 31 21:05:44 2008
New Revision: 53209
Modified:
pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py
pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py
Log:
add a way to fish the class of a method given an ootype.Meth type
(only works for BuiltinADTType so far)
Modified: pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/ootype.py Mon Mar 31 21:05:44 2008
@@ -266,6 +266,8 @@
class Meth(StaticMethod):
+ SELFTYPE = None
+
def __init__(self, args, result):
StaticMethod.__init__(self, args, result)
@@ -330,7 +332,9 @@
for name, meth in self._GENERIC_METHODS.iteritems():
args = [self._specialize_type(arg, generic_types) for arg in meth.ARGS]
result = self._specialize_type(meth.RESULT, generic_types)
- methods[name] = Meth(args, result)
+ METH = Meth(args, result)
+ METH.SELFTYPE = self
+ methods[name] = METH
self._METHODS = frozendict(methods)
self._can_raise = tuple(can_raise)
Modified: pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py (original)
+++ pypy/branch/jit-hotpath/pypy/rpython/ootypesystem/test/test_ootype.py Mon Mar 31 21:05:44 2008
@@ -207,6 +207,11 @@
c = new(C)
assert c.foo(c) == 42
+def test_method_selftype():
+ LIST = List(Signed)
+ _, meth = LIST._lookup('ll_setitem_fast')
+ METH = typeOf(meth)
+ assert METH.SELFTYPE is LIST
def test_explicit_name_clash():
C = Instance("test", ROOT, {})
_______________________________________________
pypy-svn mailing list
pypy-svn@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic