TD: Wrap PyArg_ParseTupleAndKeywords
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user