Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f394597

Browse files
authored
Merge pull request #25850 from anntzer/exc
Handle exceptions in numpy::array_view<...>::set().
2 parents f7524f4 + ee3e424 commit f394597

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/py_converters.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ int convert_points(PyObject *obj, void *pointsp)
510510
if (obj == NULL || obj == Py_None) {
511511
return 1;
512512
}
513-
points->set(obj);
514-
if (points->size() && !check_trailing_shape(*points, "points", 2)) {
513+
if (!points->set(obj)
514+
|| points->size() && !check_trailing_shape(*points, "points", 2)) {
515515
return 0;
516516
}
517517
return 1;
@@ -523,8 +523,8 @@ int convert_transforms(PyObject *obj, void *transp)
523523
if (obj == NULL || obj == Py_None) {
524524
return 1;
525525
}
526-
trans->set(obj);
527-
if (trans->size() && !check_trailing_shape(*trans, "transforms", 3, 3)) {
526+
if (!trans->set(obj)
527+
|| trans->size() && !check_trailing_shape(*trans, "transforms", 3, 3)) {
528528
return 0;
529529
}
530530
return 1;
@@ -536,8 +536,8 @@ int convert_bboxes(PyObject *obj, void *bboxp)
536536
if (obj == NULL || obj == Py_None) {
537537
return 1;
538538
}
539-
bbox->set(obj);
540-
if (bbox->size() && !check_trailing_shape(*bbox, "bbox array", 2, 2)) {
539+
if (!bbox->set(obj)
540+
|| bbox->size() && !check_trailing_shape(*bbox, "bbox array", 2, 2)) {
541541
return 0;
542542
}
543543
return 1;
@@ -549,8 +549,8 @@ int convert_colors(PyObject *obj, void *colorsp)
549549
if (obj == NULL || obj == Py_None) {
550550
return 1;
551551
}
552-
colors->set(obj);
553-
if (colors->size() && !check_trailing_shape(*colors, "colors", 4)) {
552+
if (!colors->set(obj)
553+
|| colors->size() && !check_trailing_shape(*colors, "colors", 4)) {
554554
return 0;
555555
}
556556
return 1;

0 commit comments

Comments
 (0)