Add negative index to PixelAccess#3406
Add negative index to PixelAccess#3406hugovk merged 3 commits intopython-pillow:masterfrom Nazime:negativeindex
Conversation
There was a problem hiding this comment.
Please could you add unit tests?
(I'm a little surprised this new code has coverage!)
Are these changes needed in both the Python and C layers?
src/_imaging.c
Outdated
| if (x < 0){ | ||
| x = im->xsize + x; | ||
| } | ||
| if (y < 0){ |
There was a problem hiding this comment.
Please add a space between ) and {, here and above.
src/PIL/PyAccess.py
Outdated
| (x, y) = xy | ||
| if (x < 0): | ||
| x = self.xsize + x | ||
| if (y < 0): |
There was a problem hiding this comment.
Please remove redundant parentheses, here and above.
|
I will add unit tests. I don't know if the changes are needed in both C and python (I don't know how they are connected, I am new to Pillow), When i changed it in the Python code it didn't work. |
|
Thanks for this. You’ve added getting the negative index - it would be good to also add setting.
|
|
What do you mean by add setting? |
|
You have added support for |
|
Oh yes, I'll add that too. |
Add setting negative pixels and unittest
misspelled variable name
|
Let's remember to add this to the release notes. |
Add a negative indexing to the PixelAccess so we can get the last pixels easily