Skip to content

Return bool from isblock function - #2775

Merged
wiredfool merged 1 commit into
python-pillow:masterfrom
cgohlke:patch-4
Oct 2, 2017
Merged

wiredfool merged 1 commit into
python-pillow:masterfrom
cgohlke:patch-4

Conversation

@cgohlke

@cgohlke cgohlke commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

Maybe I am missing something, but it looks like the isblock function should return a bool.

This also fixes a compiler warning and a potential issue on 64-bit Windows:

_imaging.c(1759): warning C4311: 'type cast': pointer truncation from 'char *' to 'long'

@wiredfool

Copy link
Copy Markdown
Member

This is used in one place in the code, ImageTk.py. Boolean or integer is fine from the caller's point of view. The compiler's complaint is the cast truncation. We could probably do something along the lines of

  return PyBool_fromLong(self->image->block != NULL);

We'd get the new reference without explicitly dealing with Py_True and Py_False.

@wiredfool
wiredfool merged commit 417dfe4 into python-pillow:master Oct 2, 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.

2 participants