Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agg restore_region is broken #4913

Merged
merged 1 commit into from
Aug 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,10 @@ def restore_region(self, region, bbox=None, xy=None):
else:
ox, oy = xy

self._renderer.restore_region(region, x1, y1, x2, y2, ox, oy)
# The incoming data is float, but the _renderer type-checking wants
# to see integers.
self._renderer.restore_region(region, int(x1), int(y1),
int(x2), int(y2), int(ox), int(oy))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be pedantic, not all of the incoming data is coming in as floats. For example, region.get_extents() will return integers, which is probably why we didn't notice this bug as I think that is the typical code-path. I haven't checked what bbox.extents would return, but certainly input-sanitation should be done anyway due to the possibility of the user passing in a tuple of floats as a bbox.

How did you trigger the error?


else:
self._renderer.restore_region(region)
Expand Down