Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f677ac8

Browse filesBrowse files
committed
Fix reference counting
1 parent 079b2bb commit f677ac8
Copy full SHA for f677ac8

File tree

1 file changed

+9
-5
lines changed
Filter options

1 file changed

+9
-5
lines changed

‎src/_image_wrapper.cpp

Copy file name to clipboardExpand all lines: src/_image_wrapper.cpp
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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, &params.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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.