Skip to content

Avoid recursion for subclasses of str that are also "PathLike" in to_filehandle() #11307

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 25, 2018

Conversation

Nodd
Copy link
Contributor

@Nodd Nodd commented May 25, 2018

This is the case for path.py for example.

Fixes gh-11306

PR Summary

If the path to savefig is both a subclass of str and a PathLike object, to_filehandle() creates an infinite recursion.
The PR simplifies the code while avoiding this corner case.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 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

@jklymak jklymak merged commit 0231fae into matplotlib:master May 25, 2018
@jklymak
Copy link
Member

jklymak commented May 25, 2018

Thanks @Nodd !

@QuLogic
Copy link
Member

QuLogic commented Jun 5, 2018

@anntzer should be backported?

@anntzer
Copy link
Contributor

anntzer commented Jun 5, 2018

I guess it counts as a regression in 2.2, so backporting is probably a good idea.
@meeseekdev backport to 2.2.x

@QuLogic
Copy link
Member

QuLogic commented Jun 5, 2018

@meeseeksdev backport to 2.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jun 5, 2018

Something went wrong ... Please have a look at my logs.

@QuLogic
Copy link
Member

QuLogic commented Jun 5, 2018

Grr, need to spell the bot name and the branch name correctly...

@meeseeksdev backport to v2.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jun 5, 2018

There seem to be a conflict, please backport manually

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.

savefig and path.py
5 participants