From 8e332eb3b06812adaa497463f0de97f9ec84d1cb Mon Sep 17 00:00:00 2001 From: Alexander Karpinsky Date: Mon, 7 Oct 2024 12:51:44 +0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- Tests/test_image_getim.py | 2 +- src/_imaging.c | 5 +++-- src/_imagingmorph.c | 4 ++-- src/libImaging/Imaging.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Tests/test_image_getim.py b/Tests/test_image_getim.py index 75d97cd4451..fa58492fc76 100644 --- a/Tests/test_image_getim.py +++ b/Tests/test_image_getim.py @@ -16,4 +16,4 @@ def test_sanity() -> None: with pytest.warns(DeprecationWarning): ptrs = dict(im.im.unsafe_ptrs) - assert all(k in ptrs for k in ["image8", "image32", "image"]) + assert ptrs.keys() == {"image8", "image32", "image"} diff --git a/src/_imaging.c b/src/_imaging.c index 9422c42bfaf..d5eb69314e8 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -3706,7 +3706,7 @@ static PyObject * _getattr_id(ImagingObject *self, void *closure) { if (PyErr_WarnEx( PyExc_DeprecationWarning, - "id property is deprecated and will be removed in Pillow 12.0", + "id property is deprecated and will be removed in Pillow 12 (2025-10-15)", 1 ) < 0) { return NULL; @@ -3732,7 +3732,8 @@ static PyObject * _getattr_unsafe_ptrs(ImagingObject *self, void *closure) { if (PyErr_WarnEx( PyExc_DeprecationWarning, - "unsafe_ptrs property is deprecated and will be removed in Pillow 12.0", + "unsafe_ptrs property is deprecated and will be removed in Pillow 12 " + "(2025-10-15)", 1 ) < 0) { return NULL; diff --git a/src/_imagingmorph.c b/src/_imagingmorph.c index 637295be710..b4da47b7766 100644 --- a/src/_imagingmorph.c +++ b/src/_imagingmorph.c @@ -29,8 +29,8 @@ static PyObject * apply(PyObject *self, PyObject *args) { const char *lut; - PyObject *i0, *i1; Py_ssize_t lut_len; + PyObject *i0, *i1; Imaging imgin, imgout; int width, height; int row_idx, col_idx; @@ -124,8 +124,8 @@ apply(PyObject *self, PyObject *args) { static PyObject * match(PyObject *self, PyObject *args) { const char *lut; - PyObject *i0; Py_ssize_t lut_len; + PyObject *i0; Imaging imgin; int width, height; int row_idx, col_idx; diff --git a/src/libImaging/Imaging.h b/src/libImaging/Imaging.h index 870f5ed971a..31052c68a97 100644 --- a/src/libImaging/Imaging.h +++ b/src/libImaging/Imaging.h @@ -60,7 +60,7 @@ typedef struct ImagingHistogramInstance *ImagingHistogram; typedef struct ImagingOutlineInstance *ImagingOutline; typedef struct ImagingPaletteInstance *ImagingPalette; -/* handle magics (used with PyCObject). */ +/* handle magics (used with PyCapsule). */ #define IMAGING_MAGIC "Pillow Imaging" /* pixel types */