8000 Don't catch polymorphic exceptions by value. · matplotlib/matplotlib@26edf61 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26edf61

Browse files
committed
Don't catch polymorphic exceptions by value.
This causes warnings with GCC 8, also clangtidy. We don't use the variable anyway, so the exact type is not a big deal for us.
1 parent 7e84064 commit 26edf61

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/_path_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,15 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *k
441441
numpy::array_view<double, 2> result(dims);
442442
CALL_CPP("affine_transform", (affine_transform_2d(vertices, trans, result)));
443443
return result.pyobj();
444-
} catch (py::exception) {
444+
} catch (py::exception &) {
445445
PyErr_Clear();
446446
try {
447447
numpy::array_view<double, 1> vertices(vertices_obj);
448448
npy_intp dims[] = { (npy_intp)vertices.size() };
449449
numpy::array_view<double, 1> result(dims);
450450
CALL_CPP("affine_transform", (affine_transform_1d(vertices, trans, result)));
451451
return result.pyobj();
452-
} catch (py::exception) {
452+
} catch (py::exception &) {
453453
return NULL;
454454
}
455455
}

src/py_converters.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ int convert_rect(PyObject *rectobj, void *rectp)
167167
rect->x2 = rect_arr(1, 0);
168168
rect->y2 = rect_arr(1, 1);
169169
}
170-
catch (py::exception)
170+
catch (py::exception &)
171171
{
172172
PyErr_Clear();
173173

@@ -185,7 +185,7 @@ int convert_rect(PyObject *rectobj, void *rectp)
185185
rect->x2 = rect_arr(2);
186186
rect->y2 = rect_arr(3);
187187
}
188-
catch (py::exception)
188+
catch (py::exception &)
189189
{
190190
return 0;
191191
}
@@ -347,7 +347,7 @@ int convert_trans_affine(PyObject *obj, void *transp)
347347
return 1;
348348
}
349349
}
350-
catch (py::exception)
350+
catch (py::exception &)
351351
{
352352
return 0;
353353
}

src/py_exceptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class exception : public std::exception
3030
} \
3131
return (errorcode); \
3232
} \
33-
catch (const std::bad_alloc) \
33+
catch (const std::bad_alloc &) \
3434
{ \
3535
PyErr_Format(PyExc_MemoryError, "In %s: Out of memory", (name)); \
3636
{ \

0 commit comments

Comments
 (0)
0