# Python Overloading Resolution issue with vtkMultiProcessController::Gather

**URL:** https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023
**Category:** Support
**Created:** [July 26, 2022, 2:49pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023 "2022-07-26T14:49:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [July 26, 2022, 2:49pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023/1 "2022-07-26T14:49:34Z")

</div>

I want to invoke the following function from python:

```nohighlight
  int Gather(vtkDataObject* sendBuffer, std::vector<vtkSmartPointer<vtkDataObject>>& recvBuffer,
    int destProcessId)

```

I have the following python code

```python
  gathered_output_surfaces = []
  controller.Gather(outputSurface, gathered_output_surfaces, 0)

```

outputSurface is a vtkPolyData result from vtkDataSetSurfaceFilter.

When i try to invoke gather, i get

TypeError: Gather argument 1: method requires a vtkDataArray, a vtkPolyData was provided.

Which means that it tries to call the wrong function, because of overloading resolution issues.

If i rename the function that i want to call to GatherDataObject, everything works just fine.

Do you have any suggestions @dgobbi?

cc: @ben.boeckel

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 26, 2022, 2:52pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023/2 "2022-07-26T14:52:44Z")

</div>

What other overloads exist and what order are they declared in the class?

Note that the case of an empty `[]` argument, there is nothing to help with the type deduction here.

---

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [July 26, 2022, 2:59pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023/3 "2022-07-26T14:59:21Z")

</div>

There are many Gather Overloads [VTK/vtkMultiProcessController.h at master · Kitware/VTK · GitHub](https://github.com/Kitware/VTK/blob/master/Parallel/Core/vtkMultiProcessController.h)

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [July 26, 2022, 3:35pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023/4 "2022-07-26T15:35:46Z")

</div>

Seems that overload resolution is buggy for `std::vector<vtkSmartPointer<...>>`, so the wrappers fall back to the `vtkDataArray*` overload instead. I’ll investigate.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [July 26, 2022, 11:04pm UTC](https://discourse.vtk.org/t/python-overloading-resolution-issue-with-vtkmultiprocesscontroller-gather/9023/5 "2022-07-26T23:04:39Z")

</div>

I’ve submitted [!9434](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9434) to fix the issue.

Ben is correct that using passing `[vtkPolyData()]` instead of just `[]` provides additional type information for overload resolution. But for this particular set of overloads, just `[]` is sufficient. That is, the additional bit of type info isn’t needed in this particular case.
