8000 Fix empty FancyArrow crash by nathan78906 · Pull Request #13652 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix empty FancyArrow crash #13652

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

Merged
merged 1 commit into from
Mar 12, 2019
Merged

Conversation

nathan78906
Copy link
Contributor
@nathan78906 nathan78906 commented Mar 11, 2019

PR Summary

If dx, dy, and head_length are 0, then creating a FancyArrow will crash(ValueError).
This is due to setting verts = [].
This gets passed into Path which expects verts to be a Nx2 numpy array.

The fix is to set verts to be an empty 0x2 numpy array.

Also added a simple test for this.

This PR fixes #11217

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

If dx, dy, and head_length are 0, then creating a FancyArrow will crash(ValueError).
This is due to setting verts = [].
This gets passed into Path which expects verts to be a Nx2 numpy array.

The fix is to set verts to be an empty 0x2 numpy array.
Copy link
Member
@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@jklymak jklymak added this to the v3.1.1 milestone Mar 11, 2019
@anntzer anntzer modified the milestones: v3.1.1, v3.1.0 Mar 12, 2019
@anntzer
Copy link
Contributor
anntzer commented Mar 12, 2019

Thanks for the PR, hoping to see you around again!

@anntzer anntzer merged commit adda7cc into matplotlib:master Mar 12, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 12, 2019
timhoffm added a commit that referenced this pull request Mar 12, 2019
…652-on-v3.1.x

Backport PR #13652 on branch v3.1.x (Fix empty FancyArrow crash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on zero-length FancyArrow
3 participants
0