sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #18614
[Bug 1190167] Re: Jython: subclassing Region, overwriting Region methods and using super(): crashes with stack overflow caused by inheritance loop --- workaround
There seem to be some problems in Jython 2.5 with using super(), like it
should be used with Python versions < 3.0.
I did not get even simple basic inheritance running with overwritten methods (I did not use any Sikuli features).
The problem only arises when overwriting methods.
So if you want to overwrite methods in sub classes, this is how it works
(this example is for Sikuli's class Region):
class Sub(Region):
def __init__(self, reg):
Region.__init__(self, reg)
def find(self, ps):
return Region.find(self, ps)
r = Region(0,0,300,300)
y = Sub(r)
print y.find("e4.png") # my test case ;-)
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1190167
Title:
Jython: subclassing Region, overwriting Region methods and using
super(): crashes with stack overflow caused by inheritance loop ---
workaround
Status in Sikuli:
Confirmed
Bug description:
*** workaround: see comment #1
---------------------------------------------------
I'm trying to make a subclass of Region. Here's the relevant code:
class MyRegion(Region):
def __init__(self, region, regionName = "noNameDefined"):
super(MyRegion, self).__init__(region)
self.name = regionName
(...)
def find(self, ps):
popup("about to find something")
return super(MyRegion, self).find(ps)
popup("found something")
def dupeFind(self, ps):
popup("about to find something in dupe")
return super(MyRegion, self).find(ps)
popup("found something in dupe")
When I call my dupeFind method, I expect it to pass the call on to the
superclass and return a match. What happens instead is that execution
goes to the find method above it, which then calls itself indefinitely
until I get a "RuntimeError ( maximum recursion depth exceeded )"
since the recursion has busted the stack.
What's going wrong?
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1190167/+subscriptions
References