File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ void QuadContourGenerator::append_contour_line_to_vertices(
396
396
line (i, 0 ) = point->x ;
397
397
line (i, 1 ) = point->y ;
398
398
}
399
- if (PyList_Append (vertices_list, line.pyobj ())) {
399
+ if (PyList_Append (vertices_list, line.pyobj_steal ())) {
400
400
Py_XDECREF (vertices_list);
401
401
throw " Unable to add contour line to vertices_list" ;
402
402
}
@@ -470,8 +470,8 @@ void QuadContourGenerator::append_contour_to_vertices_and_codes(
470
470
child.clear_parent (); // To indicate it can be deleted.
471
471
}
472
472
473
- if (PyList_Append (vertices_list, vertices.pyobj ()) ||
474
- PyList_Append (codes_list, codes.pyobj ())) {
473
+ if (PyList_Append (vertices_list, vertices.pyobj_steal ()) ||
474
+ PyList_Append (codes_list, codes.pyobj_steal ())) {
475
475
Py_XDECREF (vertices_list);
476
476
Py_XDECREF (codes_list);
477
477
contour.delete_contour_lines ();
Original file line number Diff line number Diff line change @@ -525,12 +525,19 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
525
525
return (T *)m_data;
526
526
}
527
527
528
+ // Return a new reference.
528
529
PyObject *pyobj ()
529
530
{
530
531
Py_XINCREF (m_arr);
531
532
return (PyObject *)m_arr;
532
533
}
533
534
535
+ // Steal a reference.
536
+ PyObject *pyobj_steal ()
537
+ {
538
+ return (PyObject *)m_arr;
539
+ }
540
+
534
541
static int converter (PyObject *obj, void *arrp)
535
542
{
536
543
array_view<T, ND> *arr = (array_view<T, ND> *)arrp;
You can’t perform that action at this time.
0 commit comments