MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkPythonSequenceError

Function vtkPythonSequenceError

Wrapping/PythonCore/vtkPythonArgs.cxx:1567–1587  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Raise a type error for a sequence arg of wrong type or size.

Source from the content-addressed store, hash-verified

1565//------------------------------------------------------------------------------
1566// Raise a type error for a sequence arg of wrong type or size.
1567bool vtkPythonSequenceError(PyObject* o, size_t n, size_t m)
1568{
1569 char text[80];
1570 if (m == n)
1571 {
1572
1573 auto result =
1574 vtk::format_to_n(text, sizeof(text), "expected a sequence of {:d} value{:s}, got {:s}",
1575 static_cast<long long>(n), ((n == 1) ? "" : "s"), vtkPythonUtil::GetTypeNameForObject(o));
1576 *result.out = '\0';
1577 }
1578 else
1579 {
1580 auto result =
1581 vtk::format_to_n(text, sizeof(text), "expected a sequence of {:d} value{:s}, got {:d} values",
1582 static_cast<long long>(n), ((n == 1) ? "" : "s"), static_cast<long long>(m));
1583 *result.out = '\0';
1584 }
1585 PyErr_SetString(PyExc_TypeError, text);
1586 return false;
1587}
1588
1589//------------------------------------------------------------------------------
1590// Checking size of array arg.

Callers 6

vtkPythonGetArrayFunction · 0.85
vtkPythonGetNArrayFunction · 0.85
vtkPythonSetArrayFunction · 0.85
vtkPythonSetNArrayFunction · 0.85
GetArrayMethod · 0.85
CheckSizeHintMethod · 0.85

Calls 1

format_to_nFunction · 0.50

Tested by

no test coverage detected