summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1990-10-26 13:44:32 (GMT)
committerGuido van Rossum <guido@python.org>1990-10-26 13:44:32 (GMT)
commit124eb94270420a20ab4b296a60b6cc508d9d950c (patch)
treeea005ae6ca50b78a090e22d1739dcce4a1362178 /Lib
parente1f069ec9831c263ddbf6fd5b997a115212f9262 (diff)
downloadcpython-124eb94270420a20ab4b296a60b6cc508d9d950c.zip
cpython-124eb94270420a20ab4b296a60b6cc508d9d950c.tar.gz
cpython-124eb94270420a20ab4b296a60b6cc508d9d950c.tar.bz2
Fix bug in rect.intersect(): empty rects beyond the first were
ignored instead of making the outcome empty...
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-stdwin/rect.py17
-rwxr-xr-xLib/stdwin/rect.py17
2 files changed, 18 insertions, 16 deletions
diff --git a/Lib/lib-stdwin/rect.py b/Lib/lib-stdwin/rect.py
index c044b9f..aa5ff44 100644
--- a/Lib/lib-stdwin/rect.py
+++ b/Lib/lib-stdwin/rect.py
@@ -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)
diff --git a/Lib/stdwin/rect.py b/Lib/stdwin/rect.py
index c044b9f..aa5ff44 100755
--- a/Lib/stdwin/rect.py
+++ b/Lib/stdwin/rect.py
@@ -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)