@@ -170,10 +170,11 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
170170 }
171171
172172 py_is_affine2 = PyObject_IsTrue (py_is_affine);
173+ Py_DECREF (py_is_affine);
173174
174175 if (py_is_affine2 == -1 ) {
175176 goto error;
176- } else if (py_is_affine2 == 1 ) {
177+ } else if (py_is_affine2) {
177178 if (!convert_trans_affine (py_transform, ¶ms.affine )) {
178179 goto error;
179180 }
@@ -190,8 +191,10 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
190191 }
191192
192193 if (PyArray_NDIM (input_array) != PyArray_NDIM (output_array)) {
193- PyErr_Format (PyExc_ValueError, " Mismatched number of dimensions. Got %d and %d." ,
194- PyArray_NDIM (input_array), PyArray_NDIM (output_array));
194+ PyErr_Format (
195+ PyExc_ValueError,
196+ " Mismatched number of dimensions. Got %d and %d." ,
197+ PyArray_NDIM (input_array), PyArray_NDIM (output_array));
195198 goto error;
196199 }
197200
@@ -202,8 +205,9 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
202205
203206 if (PyArray_NDIM (input_array) == 3 ) {
204207 if (PyArray_DIM (output_array, 2 ) != 4 ) {
205- PyErr_SetString (PyExc_ValueError,
206- " Output array must be RGBA" );
208+ PyErr_SetString (
209+ PyExc_ValueError,
210+ " Output array must be RGBA" );
207211 goto error;
208212 }
209213
0 commit comments