[pypy-dev] demoting method, cannot follow, call result degenerated

Hart's Antler bhartsho at yahoo.com
Thu Aug 5 03:14:10 CEST 2010


Thanks for clarifying Fijal, putting dummy functions on the base class fixes the demotion errors.

But now i have a new problem, from the bookkeeper, unpackiterable.
pypy.annotation.bookkeeper.CallPatternTooComplex': '*' argument must be SomeTuple
	.. v2 = call_args(v0, ((0, (), True, False)), v1)
	.. '(rbpy:1)BPY_Object_MESH.GET_location'

I checked the object, instead of SomeTuple it is SomeObject.
I'm trying to understand what causes the CallPatternTooComplex error, i can not reproduce it with a simple model that is close to what my actual code is doing.

class T(object):
	def hi( self, *args ): pass
class TA( T ):
	def hi( self, a,b,c ): pass
class TB( T ):
	def hi( self, y ): pass

def pypy_entrypoint():
	t = T()
	ta = TA()
	tb = TB()
	ta.hi(1,2,'x')
	tb.hi()
	tb.hi('xxx')
	print 'too complex test'

the above translates just fine, no TooComplex error.
-brett


--- On Wed, 8/4/10, Maciej Fijalkowski <fijall at gmail.com> wrote:

> From: Maciej Fijalkowski <fijall at gmail.com>
> Subject: Re: [pypy-dev] demoting method, cannot follow, call result  degenerated
> To: "Hart's Antler" <bhartsho at yahoo.com>
> Cc: pypy-dev at codespeak.net
> Date: Wednesday, 4 August, 2010, 1:25 AM
> Hey.
> 
> If at any place in code you want to call methods on a thing
> that can't
> be proven to be of a specific subclass, they have to be
> defined on a
> superclass (even dummy versions).
> 
> If you are however sure that this object will be of a
> specific subclass, write:
> assert isinstance(x, MySubclass)
> x.specific_method
> 
> that's fine
> 
> On Wed, Aug 4, 2010 at 10:21 AM, Hart's Antler <bhartsho at yahoo.com>
> wrote:
> > I'm still struggling to learn all the rules of
> RPython, i have read the coding guide, and the PDF's PyGirl
> and Ancona's RPython paper, but still i feel i'm not fully
> grasping everything.
> >
> > I have a function that returns different classes that
> all share a common base class.  It works until i introduce
> a new subclass that has some methods of the same name.
>  Then i get the demotion, can not follow, degenerated
> error.
> >
> > I googled, but all i can find is an IRC log where
> Fijal seems to taking talking about my problem.
> > http://www.tismer.com/pypy/irc-logs/pypy/%23pypy.log.20070125
> >
> > <fijal> pedronis: if function can return (in
> rpython) set of classes with common superclass, than all
> methods that I call later must be defined on that
> superclass, right?
> >
> > [11:30] <fijal> [15:01] <pedronis> yes,
> unless you assert a specific subclass
> >
> > So i just need to use an assert statement before the
> function return, and assert the class i am returning?
> >
> > I am blogging about my progress while learning
> RPython, i have posted about meta-programming in Rpython
> which is a new concept to me.
> >
> > http://pyppet.blogspot.com/2010/08/meta-programming-in-rpython.html
> >
> > -brett
> >
> >
> >
> > _______________________________________________
> > pypy-dev at codespeak.net
> > http://codespeak.net/mailman/listinfo/pypy-dev
> >
> 






More information about the Pypy-dev mailing list