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

test_make_inmemory_image_should_pass fails on s390x and ppc64 #31

Closed
jayvdb opened this issue Apr 9, 2019 · 3 comments
Closed

test_make_inmemory_image_should_pass fails on s390x and ppc64 #31

jayvdb opened this issue Apr 9, 2019 · 3 comments

Comments

@jayvdb
Copy link

jayvdb commented Apr 9, 2019

I am packaging this and djoser for openSUSE, and their default test envs include s390x and ppc64.

The test test_make_inmemory_image_should_pass fails on those two platforms, e.g. the following on 'ppc64'

Full logs can be see at https://build.opensuse.org/package/show/home:jayvdb:django/python-djet after logging in.

[   76s] __________ InMemoryFilesTestCase.test_make_inmemory_image_should_pass __________
[   76s] 
[   76s] self = <testproject.testapp.tests.test_files.InMemoryFilesTestCase testMethod=test_make_inmemory_image_should_pass>
[   76s] 
[   76s]     @unittest.skipUnless(PIL, 'PIL is not installed')
[   76s]     def test_make_inmemory_image_should_pass(self):
[   76s] >       file = files.create_inmemory_image('test.png', format='PNG')
[   76s] 
[   76s] testapp/tests/test_files.py:23: 
[   76s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   76s] ../djet/files.py:95: in create_inmemory_image
[   76s]     image.save(stream, format=format)
[   76s] /usr/lib64/python2.7/site-packages/PIL/Image.py:2007: in save
[   76s]     save_handler(self, fp, filename)
[   76s] /usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.py:896: in _save
[   76s]     [("zip", (0, 0)+im.size, 0, rawmode)])
[   76s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   76s] 
[   76s] im = <PIL.Image.Image image mode=RGBA size=200x200 at 0x7FFFA1E28710>
[   76s] fp = <PIL.PngImagePlugin._idat object at 0x7fffa1e28550>
[   76s] tile = [('zip', (0, 0, 200, 200), 0, 'RGBA')], bufsize = 65536
[   76s] 
[   76s]     def _save(im, fp, tile, bufsize=0):
[   76s]         """Helper to save image based on tile list
[   76s]     
[   76s]         :param im: Image object.
[   76s]         :param fp: File object.
[   76s]         :param tile: Tile list.
[   76s]         :param bufsize: Optional buffer size
[   76s]         """
[   76s]     
[   76s]         im.load()
[   76s]         if not hasattr(im, "encoderconfig"):
[   76s]             im.encoderconfig = ()
[   76s]         tile.sort(key=_tilesort)
[   76s]         # FIXME: make MAXBLOCK a configuration parameter
[   76s]         # It would be great if we could have the encoder specify what it needs
[   76s]         # But, it would need at least the image size in most cases. RawEncode is
[   76s]         # a tricky case.
[   76s]         bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4)  # see RawEncode.c
[   76s]         if fp == sys.stdout:
[   76s]             fp.flush()
[   76s]             return
[   76s]         try:
[   76s]             fh = fp.fileno()
[   76s]             fp.flush()
[   76s]         except (AttributeError, io.UnsupportedOperation):
[   76s]             # compress to Python file-compatible object
[   76s]             for e, b, o, a in tile:
[   76s]                 e = Image._getencoder(im.mode, e, a, im.encoderconfig)
[   76s]                 if o > 0:
[   76s]                     fp.seek(o)
[   76s] >               e.setimage(im.im, b)
[   76s] E               SystemError: tile cannot extend outside image
[   76s] 
[   76s] /usr/lib64/python2.7/site-packages/PIL/ImageFile.py:496: SystemError
@dekoza
Copy link
Contributor

dekoza commented Apr 10, 2019

  1. What PIL version?
  2. What are the chances that this is PIL bug?

@jayvdb
Copy link
Author

jayvdb commented Apr 10, 2019

This is using rpms

python2-Pillow-6.0.0-88.1
python3-Pillow-6.0.0-88.1

Source for it is https://build.opensuse.org/package/show/devel:languages:python/python-Pillow

And behold ... it has some similar exceptions there, so probably a bug in PIL. It refers to python-pillow/Pillow#1204

%check
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
%ifarch ppc ppc64 s390 s390x
$python selftest.py --installed || \
echo "WARNING ignore failure https://github.com/python-pillow/Pillow/issues/1204"
$python setup.py test  || \
echo "WARNING ignore failure https://github.com/python-pillow/Pillow/issues/1204"
%else
$python selftest.py --installed
$python setup.py test
%endif
}

@dekoza
Copy link
Contributor

dekoza commented Apr 10, 2019

Yes, looks like bug in PIL. Closing for now. Please feel free to reopen if PIL fixes this but it still appears in djet.

@dekoza dekoza closed this as completed Apr 10, 2019
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

No branches or pull requests

2 participants