← Back to team overview

sikuli-driver team mailing list archive

[Bug 1190167] [NEW] Jython: subclassing Region, overwriting Region methods and using super(): crashes with stack overflow caused by inheritance loop --- workaround

 

Public bug reported:

*** 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?

** Affects: sikuli
     Importance: Low
     Assignee: RaiMan (raimund-hocke)
         Status: Confirmed

** Changed in: sikuli
       Status: New => Confirmed

** Changed in: sikuli
   Importance: Undecided => Low

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Description changed:

+ *** 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 __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")
+     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?

** Summary changed:

- Jython: subclassing Region, overwriting Region methods and using super(): crashes with stack overflow caused by inheritance loop
+ Jython: subclassing Region, overwriting Region methods and using super(): crashes with stack overflow caused by inheritance loop --- workaround

-- 
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


Follow ups

References