TD: Wrap PyArg_ParseTupleAndKeywords

This commit is contained in:
Chris Hennes
2023-08-25 13:19:09 -05:00
parent 089a694efa
commit c60e03741a
3 changed files with 15 additions and 9 deletions

View File

@@ -26,6 +26,7 @@
#endif
#include <Base/Console.h>
#include <Base/PyWrapParseTupleAndKeywords.h>
#include "CenterLinePy.h"
#include "DrawUtil.h"
@@ -130,8 +131,8 @@ void CenterLinePy::setFormat(Py::Dict arg)
double weight = 0.5;
PyObject* pColor = color.ptr();
PyObject* visible = Py_True;
static char* kw[] = {"style", "weight", "color", "visible", nullptr};
if (!PyArg_ParseTupleAndKeywords(dummy.ptr(), arg.ptr(), "|idO!O!", kw,
static const std::array<const char *, 5> kw{"style", "weight", "color", "visible", nullptr};
if (!Base::Wrapped_ParseTupleAndKeywords(dummy.ptr(), arg.ptr(), "|idO!O!", kw,
&style, &weight, &PyTuple_Type, &pColor, &PyBool_Type, &visible)) {
throw Py::ValueError("Expected {'style':int, 'weight':float, 'color':tuple, 'visible':bool} dict");
}