-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
get_clip_path checks for nan #11748
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
get_clip_path checks for nan #11748
Conversation
I would rather prefer we detect the invalid path and error out appropriately... |
lib/matplotlib/backend_bases.py
Outdated
if np.all(np.isfinite(tpath.vertices)): | ||
return tpath, tr | ||
else: | ||
warnings.warn("Ill-defined clip_path detected. Returning None.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be _log.warning(...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which will also reduce the line length of that line by 1 and thus make Travis (flake8) pass.
Actually, with the warning I'm fine with this approach. Good to go modulo one comment. |
change warning.warn to _log.warning
f6ddd61
to
87a3413
Compare
@leejjoon I made the change requested above and rebased on current master and pushed this to your branch. Hope that is OK |
PR Summary
Specifying an ill-defined clip_path leads to a seg-fault (#4448) with agg backends. Here is an minimal example.
The current PR simply fix this by making GraphicsContextBase.get_clip_path returns None if it contains values that are not finite.
PR Checklist