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

Fixed numpy bool bug #3790

Merged
merged 1 commit into from Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions Tests/test_numpy.py
Expand Up @@ -178,6 +178,14 @@ def test_putdata(self):

self.assertEqual(len(im.getdata()), len(arr))

def test_roundtrip_eye(self):
for dtype in (numpy.bool, numpy.bool8,
numpy.int8, numpy.int16, numpy.int32,
numpy.uint8, numpy.uint16, numpy.uint32,
numpy.float, numpy.float32, numpy.float64):
arr = numpy.eye(10, dtype=dtype)
numpy.testing.assert_array_equal(arr, numpy.array(Image.fromarray(arr)))

def test_zero_size(self):
# Shouldn't cause floating point exception
# See https://github.com/python-pillow/Pillow/issues/2259
Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/Unpack.c
Expand Up @@ -1280,7 +1280,7 @@ static struct {
{"1", "1;I", 1, unpack1I},
{"1", "1;R", 1, unpack1R},
{"1", "1;IR", 1, unpack1IR},
{"1", "1;8", 1, unpack18},
{"1", "1;8", 8, unpack18},

/* greyscale */
{"L", "L;2", 2, unpackL2},
Expand Down