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

Only close __fp if not fp #3540

Merged
merged 1 commit into from
Jan 6, 2019
Merged

Only close __fp if not fp #3540

merged 1 commit into from
Jan 6, 2019

Conversation

radarhere
Copy link
Member

See #3536

@radarhere radarhere mentioned this pull request Jan 5, 2019
27 tasks
@hugovk
Copy link
Member

hugovk commented Jan 5, 2019

Using the test files in #3536, this PR reverts the exception back to that in 5.3.0:

5.3.0

good.tiff <PIL.TiffImagePlugin.TiffImageFile image mode=RGB size=124x124 at 0x1085FFAC8>
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    f3 = Image.open('irr_cubemap.tiff')
  File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2657, in open
    % (filename if filename else fp))
OSError: cannot identify image file 'irr_cubemap.tiff'

5.4.0

good.tiff <PIL.TiffImagePlugin.TiffImageFile image mode=RGB size=124x124 at 0x10A562AC8>
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    f3 = Image.open('irr_cubemap.tiff')
  File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2676, in open
    im = _open_core(fp, filename, prefix)
  File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2657, in _open_core
    fp.seek(0)
ValueError: seek of closed file

This PR

good.tiff <PIL.TiffImagePlugin.TiffImageFile image mode=RGB size=124x124 at 0x1087B0C88>
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    f3 = Image.open('irr_cubemap.tiff')
  File "/Users/hugo/github/Pillow/src/PIL/Image.py", line 2687, in open
    % (filename if filename else fp))
OSError: cannot identify image file 'irr_cubemap.tiff'

radarhere added a commit to radarhere/Pillow that referenced this pull request Jan 6, 2019
@hugovk hugovk merged commit 4d1be57 into python-pillow:master Jan 6, 2019
hugovk added a commit that referenced this pull request Jan 6, 2019
@radarhere radarhere deleted the fp branch January 6, 2019 10:58
@radarhere radarhere mentioned this pull request Jan 6, 2019
hugovk pushed a commit that referenced this pull request Jan 6, 2019
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