diff --git a/Tests/test_pyarrow.py b/Tests/test_pyarrow.py index 76075bda2..ece9f8f26 100644 --- a/Tests/test_pyarrow.py +++ b/Tests/test_pyarrow.py @@ -17,7 +17,9 @@ pyarrow = pytest.importorskip("pyarrow", reason="PyArrow not installed") TEST_IMAGE_SIZE = (10, 10) -def _test_img_equals_pyarray(img: Image.Image, arr: Any, mask) -> None: +def _test_img_equals_pyarray( + img: Image.Image, arr: Any, mask: list[int] | None +) -> None: assert img.height * img.width == len(arr) px = img.load() assert px is not None @@ -53,7 +55,7 @@ fl_uint8_4_type = pyarrow.field( ("HSV", fl_uint8_4_type, [0, 1, 2]), ), ) -def test_to_array(mode: str, dtype: Any, mask: Any) -> None: +def test_to_array(mode: str, dtype: Any, mask: list[int] | None) -> None: img = hopper(mode) # Resize to non-square diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 04a80fb9a..188cb91f1 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -3330,7 +3330,7 @@ def fromarrow(obj: SupportsArrowArrayInterface, mode, size) -> Image: :param obj: Object with an arrow_c_array interface :param mode: Image mode. :param size: Image size. This must match the storage of the arrow object. - :returns: An Image Object + :returns: An Image object Note that according to the Arrow spec, both the producer and the consumer should consider the exported array to be immutable, as diff --git a/src/libImaging/Arrow.c b/src/libImaging/Arrow.c index 493c2a87e..33ff2ce77 100644 --- a/src/libImaging/Arrow.c +++ b/src/libImaging/Arrow.c @@ -110,7 +110,7 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) { if (retval != 0) { return retval; } - // if it's not 1 band, it's an int32 at the moment. 4 unint8 bands. + // if it's not 1 band, it's an int32 at the moment. 4 uint8 bands. schema->n_children = 1; schema->children = calloc(1, sizeof(struct ArrowSchema *)); schema->children[0] = (struct ArrowSchema *)calloc(1, sizeof(struct ArrowSchema)); @@ -137,7 +137,7 @@ release_const_array(struct ArrowArray *array) { array->buffers = NULL; } if (array->children) { - // undone -- does arrow release all the children recursively. + // undone -- does arrow release all the children recursively? for (int i = 0; i < array->n_children; i++) { if (array->children[i]->release) { array->children[i]->release(array->children[i]); @@ -235,7 +235,7 @@ export_fixed_pixel_array(Imaging im, struct ArrowArray *array) { // assert(array->buffers != NULL); array->buffers[0] = NULL; // no nulls, null bitmap can be omitted - // if it's not 1 band, it's an int32 at the moment. 4 unint8 bands. + // if it's not 1 band, it's an int32 at the moment. 4 uint8 bands. array->n_children = 1; array->children = calloc(1, sizeof(struct ArrowArray *)); if (!array->children) {