]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix bug in rect.intersect(): empty rects beyond the first were
authorGuido van Rossum <guido@python.org>
Fri, 26 Oct 1990 13:44:32 +0000 (13:44 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 26 Oct 1990 13:44:32 +0000 (13:44 +0000)
ignored instead of making the outcome empty...

Lib/lib-stdwin/rect.py
Lib/stdwin/rect.py

index c044b9f0c71d5257d0b4232e1b0de46f8038f4b6..aa5ff4449b76a0abdb78bdc9fe18a890eafc4a7c 100644 (file)
@@ -29,14 +29,15 @@ def intersect(list):
        if is_empty(list[0]): return empty
        (left, top), (right, bottom) = list[0]
        for rect in list[1:]:
-               if not is_empty(rect):
-                       (l, t), (r, b) = rect
-                       if left < l: left = l
-                       if top < t: top = t
-                       if right > r: right = r
-                       if bottom > b: bottom = b
-                       if is_empty((left, top), (right, bottom)):
-                               return empty
+               if is_empty(rect):
+                       return empty
+               (l, t), (r, b) = rect
+               if left < l: left = l
+               if top < t: top = t
+               if right > r: right = r
+               if bottom > b: bottom = b
+               if is_empty((left, top), (right, bottom)):
+                       return empty
        return (left, top), (right, bottom)
 
 
index c044b9f0c71d5257d0b4232e1b0de46f8038f4b6..aa5ff4449b76a0abdb78bdc9fe18a890eafc4a7c 100755 (executable)
@@ -29,14 +29,15 @@ def intersect(list):
        if is_empty(list[0]): return empty
        (left, top), (right, bottom) = list[0]
        for rect in list[1:]:
-               if not is_empty(rect):
-                       (l, t), (r, b) = rect
-                       if left < l: left = l
-                       if top < t: top = t
-                       if right > r: right = r
-                       if bottom > b: bottom = b
-                       if is_empty((left, top), (right, bottom)):
-                               return empty
+               if is_empty(rect):
+                       return empty
+               (l, t), (r, b) = rect
+               if left < l: left = l
+               if top < t: top = t
+               if right > r: right = r
+               if bottom > b: bottom = b
+               if is_empty((left, top), (right, bottom)):
+                       return empty
        return (left, top), (right, bottom)