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

Pickle L mode images #1095

Merged
merged 2 commits into from Jan 30, 2015
Merged

Pickle L mode images #1095

merged 2 commits into from Jan 30, 2015

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jan 30, 2015

Fixes #1093 with tests.

L mode images couldn't be pickled because they had no palette:

Traceback (most recent call last):
  File "C:\Users\hugovk\github\Pillow\tests\test_pickle.py", line 80, in test_pickle_l_mode
    self.helper_pickle_string(pickle, protocol, mode="L")
  File "C:\Users\hugovk\github\Pillow\tests\test_pickle.py", line 32, in helper_pickle_string
    loaded_im = pickle.loads(dumped_string)
  File "C:\Python27\lib\pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "C:\Python27\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "C:\Python27\lib\pickle.py", line 1217, in load_build
    setstate(state)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 629, in __setstate__
    self.putpalette(palette)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1478, in putpalette
    data = "".join(chr(x) for x in data)
TypeError: 'NoneType' object is not iterable

Failing tests:
https://travis-ci.org/hugovk/Pillow/builds/48885366

Passing with fix:
https://travis-ci.org/hugovk/Pillow/builds/48885799

wiredfool added a commit that referenced this pull request Jan 30, 2015
Fix pickling L mode images with no palette
@wiredfool wiredfool merged commit d80c27d into python-pillow:master Jan 30, 2015
@hugovk hugovk deleted the pickle_L_mode branch January 30, 2015 22:56
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.

Pickling failure on mode 'L' images
2 participants