Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix error message in plt.close(). #19490

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
Feb 11, 2021
Merged

Fix error message in plt.close(). #19490

merged 1 commit into from
Feb 11, 2021

Conversation

Iain-S
Copy link
Contributor

@Iain-S Iain-S commented Feb 10, 2021

PR Summary

Currently, the TypeError thrown when an inappropriate type is passed to pyplot.close() has the following message:

TypeError: close() argument must be a Figure, an int, a string, or None, not '%s'

This is clearly a typo (introduced in f6bdcb5) as it says '%s' instead of telling the user the type that was passed in.

We update the raise statement to include the type so that pyplot.close(1.1) gives

TypeError: close() argument must be a Figure, an int, a string, or None, not <class 'float'>

instead of

TypeError: close() argument must be a Figure, an int, a string, or None, not '%s'

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@QuLogic QuLogic added this to the v3.4.0 milestone Feb 11, 2021
@QuLogic QuLogic merged commit 56d9e7c into matplotlib:master Feb 11, 2021
@QuLogic
Copy link
Member

QuLogic commented Feb 11, 2021

Thanks @Iain-S! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again.

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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.