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

Ensure that the err_code variable is initialized before using. #2363

Merged
merged 2 commits into from Jun 14, 2017

Conversation

alexkiro
Copy link

What did you do?

Called image = image.convert("RGB")

What actually happened?

Unfortunately I cannot retrieve the actual image that causes this to occur, but there is a scenario where the err_code variable is not initialized.

  File "PIL/Image.py", line 841, in convert
  File "PIL/ImageFile.py", line 238, in load
UnboundLocalError: local variable 'err_code' referenced before assignment

What versions of Pillow and Python are you using?

  • Pillow 3.3.3
  • Python 2.7.12

@wiredfool
Copy link
Member

I'd really like to see the image where that happens. We've had another report of it, but have still never seen an image that triggers the error.

From looking at the code, it's got to be a case where a value error is thrown and silenced from each tile that's been defined.

I doubt that passing a no-error code into this is quite the right approach.

@alexkiro
Copy link
Author

I'd really like to see the image where that happens. We've had another report of it, but have still never seen an image that triggers the error.

I'll see if I can catch a live one then 👍 and send it to you.

@hugovk
Copy link
Member

hugovk commented Feb 1, 2017

See #2383 (comment)

Any case where we hit the cleanup without otherwise setting err_code is some sort of caught error that we're not considering. May not be possible anymore
@python-pillow python-pillow deleted a comment from codecov bot Jun 14, 2017
@wiredfool wiredfool merged commit f0c3df0 into python-pillow:master Jun 14, 2017
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