@@ -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
174175if (py_is_affine2 == -1 ) {
175176goto error;
176- }else if (py_is_affine2 == 1 ) {
177+ }else if (py_is_affine2) {
177178if (!convert_trans_affine (py_transform, ¶ms.affine )) {
178179goto error;
179180 }
@@ -190,8 +191,10 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
190191 }
191192
192193if (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));
195198goto error;
196199 }
197200
@@ -202,8 +205,9 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
202205
203206if (PyArray_NDIM (input_array) ==3 ) {
204207if (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" );
207211goto error;
208212 }
209213