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

Skip to content

Check number of positional arguments passed to quiver() #14084

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
May 14, 2019

Conversation

timhoffm
Copy link
Member

PR Summary

Inspired by looking into #14060, but another topic: The number of positional parameters passed to quiver() was not properly validated.

In case of just 1 parameter this results in a not quite helpful IndexError: pop from empty list.
In case of more than 5 parameters, the first 5 parameters are used and further parameters silently ignored.

This PR changes the behavior to always raise TypeError: quiver() takes 2-5 positional arguments but {len_args} were given.

Do we need an API change note for this or is this just a bug fix?

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@@ -2148,16 +2148,6 @@ def _check_and_log_subprocess(command, logger, **kwargs):
return report


def _check_not_matrix(**kwargs):
Copy link
Member Author

@timhoffm timhoffm Apr 29, 2019

Choose a reason for hiding this comment

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

This was only used in _parse_args, we don't check anywhere else in the code for np.matrix.

np.matrix itself is not recommended anymore and matplotlib usage: Types of inputs states that np.matrix may or may not work.

Therefore I don't see the need to explicitly check for this to give an error message.

Note also, this currently checked only U, V, C but not X, Y.

Copy link
Member

Choose a reason for hiding this comment

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

This was added in #13089 to fix #1558 just in 3.1.0; do we really want to revert that check so quickly?

Also, skipping X and Y was done on purpose, though perhaps that's a little unintuitive.

@jklymak jklymak merged commit 0f85365 into matplotlib:master May 14, 2019
@QuLogic QuLogic added this to the v3.2.0 milestone May 14, 2019
@timhoffm timhoffm deleted the quiver-check-nargs branch May 18, 2019 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants