Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7ea1f4

Browse files
committed
FIX: cast input to Rectangle to float
If user passes in uint, can get integer overflow (from trying to negate it). Cast all the input to Rectangle to float to be safe. Closes matplotlib#4751
1 parent 0d53ff5 commit d7ea1f4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/matplotlib/patches.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,11 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
636636

637637
Patch.__init__(self, **kwargs)
638638

639-
self._x = xy[0]
640-
self._y = xy[1]
641-
self._width = width
642-
self._height = height
643-
self._angle = angle
639+
self._x = float(xy[0])
640+
self._y = float(xy[1])
641+
self._width = float(width)
642+
self._height = float(height)
643+
self._angle = float(angle)
644644
# Note: This cannot be calculated until this is added to an Axes
645645
self._rect_transform = transforms.IdentityTransform()
646646

0 commit comments

Comments
 (0)