Skip to content
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

Accept any path-like object for Image.{open,save} and truetype, not just pathlib.Path #5621

Closed
wants to merge 7 commits into from

Conversation

ntninja
Copy link

@ntninja ntninja commented Jul 19, 2021

Also tries to fix some bugs where PIL will crash in case of binary paths, by using os.fsdecode.

Changes proposed in this pull request:

  • Accept any path-like object (as introduced with Python 3.6) where it would previously only accept str, bytes and pathlib.Path
  • Fix some crashes when using binary paths found during testing/review
  • Consistently use the word “filepath” when refering to a filesystem location, rather than the previous mix of the words “file” and “filename”

@ntninja ntninja changed the title Accept any path-like object on Image.{open,save} and truetype, not just pathlib.Path Accept any path-like object for Image.{open,save} and truetype, not just pathlib.Path Jul 19, 2021
@radarhere
Copy link
Member

Fix some crashes when using binary paths found during testing/review

Are you saying that you've found bugs, separate to the path-like object changes? Could you provide some more detail about this?

Tests/test_image.py Outdated Show resolved Hide resolved
src/PIL/Image.py Outdated Show resolved Hide resolved
src/PIL/ImageFont.py Show resolved Hide resolved
CHANGES.rst Outdated Show resolved Hide resolved
@ntninja
Copy link
Author

ntninja commented Jul 23, 2021

@radarhere: Any idea why that Windows test is failing?

@radarhere
Copy link
Member

It's an intermittent failure on master. Nothing to do with your changes.
I've rerun the job, and it passes now.

Tests/test_util.py Outdated Show resolved Hide resolved
src/PIL/ImageFont.py Outdated Show resolved Hide resolved
Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

src/PIL/Image.py Outdated Show resolved Hide resolved
src/PIL/Image.py Outdated Show resolved Hide resolved
src/PIL/Image.py Outdated Show resolved Hide resolved
src/PIL/Image.py Outdated Show resolved Hide resolved
src/PIL/ImageFont.py Outdated Show resolved Hide resolved
src/PIL/ImageFont.py Outdated Show resolved Hide resolved
src/PIL/ImageFont.py Outdated Show resolved Hide resolved
ntninja and others added 4 commits August 26, 2021 17:26
…t just `pathlib.Path`

Also tries to fix some bugs where PIL will crash in case of binary paths, by using `os.fsdecode`.
By @hugovk.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@ntninja ntninja requested a review from radarhere August 31, 2021 17:46
@radarhere
Copy link
Member

I've made a suggestion for this over at https://github.com/ntninja/Pillow/pull/2

@ntninja
Copy link
Author

ntninja commented Sep 16, 2021

I think we've resolved this now. Can we merge this then?

This pull request was closed.
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.

None yet

3 participants