diff --git a/src/Mod/Path/App/AppPathPy.cpp b/src/Mod/Path/App/AppPathPy.cpp
index 36b2c94458..5353a2bf65 100644
--- a/src/Mod/Path/App/AppPathPy.cpp
+++ b/src/Mod/Path/App/AppPathPy.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -325,13 +326,14 @@ namespace PathApp {
PyObject *pShapes=nullptr;
PyObject *start=nullptr;
PyObject *return_end=Py_False;
- static char* kwd_list[] = {"shapes", "start", "return_end",
+ static const std::array kwd_list {"shapes", "start", "return_end",
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_PATH), nullptr};
- if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
+ if (!Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
"O|O!O!" PARAM_PY_KWDS(AREA_PARAMS_PATH),
kwd_list, &pShapes, &(Base::VectorPy::Type), &start, &PyBool_Type, &return_end,
- PARAM_REF(PARAM_FARG,AREA_PARAMS_PATH)))
+ PARAM_REF(PARAM_FARG,AREA_PARAMS_PATH))) {
throw Py::Exception();
+ }
std::list shapes;
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type)))
@@ -376,10 +378,10 @@ namespace PathApp {
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_SORT)
PyObject *pShapes=nullptr;
PyObject *start=nullptr;
- static char* kwd_list[] = {"shapes", "start",
+ static const std::array kwd_list {"shapes", "start",
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_ARC_PLANE),
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SORT), nullptr};
- if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
+ if (!Base::Wrapped_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
"O|O!"
PARAM_PY_KWDS(AREA_PARAMS_ARC_PLANE)
PARAM_PY_KWDS(AREA_PARAMS_SORT),
diff --git a/src/Mod/Path/App/AreaPyImp.cpp b/src/Mod/Path/App/AreaPyImp.cpp
index 09be42d966..1bc1c0bc1c 100644
--- a/src/Mod/Path/App/AreaPyImp.cpp
+++ b/src/Mod/Path/App/AreaPyImp.cpp
@@ -22,6 +22,7 @@
#include "PreCompiled.h"
+#include
#include
#include
@@ -31,10 +32,11 @@
static PyObject * areaAbort(PyObject *, PyObject *args, PyObject *kwd) {
- static char *kwlist[] = {"aborting", nullptr};
+ static const std::array kwlist{"aborting", nullptr};
PyObject *pObj = Py_True;
- if (!PyArg_ParseTupleAndKeywords(args,kwd,"|O!",kwlist,&PyBool_Type,&pObj))
+ if (!Base::Wrapped_ParseTupleAndKeywords(args,kwd,"|O!",kwlist,&PyBool_Type,&pObj)) {
return nullptr;
+ }
Area::abort(Base::asBoolean(pObj));
@@ -43,7 +45,7 @@ static PyObject * areaAbort(PyObject *, PyObject *args, PyObject *kwd) {
static PyObject * areaSetParams(PyObject *, PyObject *args, PyObject *kwd) {
- static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_STATIC_CONF),nullptr};
+ static const std::array kwlist {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_STATIC_CONF),nullptr};
if(args && PySequence_Size(args)>0)
PyErr_SetString(PyExc_ValueError,"Non-keyword argument is not supported");
@@ -60,7 +62,7 @@ static PyObject * areaSetParams(PyObject *, PyObject *args, PyObject *kwd) {
PARAM_FOREACH(AREA_SET,AREA_PARAMS_STATIC_CONF)
//Parse arguments to overwrite CONF variables
- if (!PyArg_ParseTupleAndKeywords(args, kwd,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, kwd,
"|" PARAM_PY_KWDS(AREA_PARAMS_STATIC_CONF), kwlist,
PARAM_REF(PARAM_FNAME,AREA_PARAMS_STATIC_CONF)))
return nullptr;
@@ -90,8 +92,8 @@ static PyObject* areaGetParams(PyObject *, PyObject *args) {
static PyObject * areaGetParamsDesc(PyObject *, PyObject *args, PyObject *kwd) {
PyObject *pcObj = Py_False;
- static char *kwlist[] = {"as_string", nullptr};
- if (!PyArg_ParseTupleAndKeywords(args, kwd, "|O!",kwlist,&PyBool_Type,&pcObj))
+ static const std::array kwlist {"as_string", nullptr};
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, kwd, "|O!",kwlist,&PyBool_Type,&pcObj))
return nullptr;
if (Base::asBoolean(pcObj))
@@ -250,8 +252,8 @@ PyObject* AreaPy::getShape(PyObject *args, PyObject *keywds)
{
PyObject *pcObj = Py_False;
short index=-1;
- static char *kwlist[] = {"index","rebuild", nullptr};
- if (!PyArg_ParseTupleAndKeywords(args, keywds,"|hO!",kwlist,&index,&PyBool_Type,&pcObj))
+ static const std::array kwlist{"index", "rebuild", nullptr};
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,"|hO!",kwlist,&index,&PyBool_Type,&pcObj))
return nullptr;
PY_TRY {
@@ -269,9 +271,9 @@ PyObject* AreaPy::add(PyObject *args, PyObject *keywds)
//Strangely, PyArg_ParseTupleAndKeywords requires all arguments to be keyword based,
//even non-optional ones? That doesn't make sense in python. Seems only in python 3
//they added '$' to address that issue.
- static char *kwlist[] = {"shape",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OPCODE), nullptr};
+ static const std::array kwlist {"shape",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OPCODE), nullptr};
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"O|" PARAM_PY_KWDS(AREA_PARAMS_OPCODE),
kwlist,&pcObj,PARAM_REF(PARAM_FARG,AREA_PARAMS_OPCODE)))
return nullptr;
@@ -308,7 +310,7 @@ PyObject* AreaPy::add(PyObject *args, PyObject *keywds)
PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
{
//Generate a keyword string defined in the ARG field of OFFSET parameter list
- static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OFFSET), nullptr};
+ static const std::array kwlist {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OFFSET), nullptr};
short index = -1;
//Declare variables defined in the ARG field of the OFFSET parameter list with
@@ -316,7 +318,7 @@ PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_OFFSET)
//Parse arguments to overwrite the defaults
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"|h" PARAM_PY_KWDS(AREA_PARAMS_OFFSET), kwlist,
&index,PARAM_REF(PARAM_FARG,AREA_PARAMS_OFFSET)))
return nullptr;
@@ -331,17 +333,18 @@ PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
PyObject* AreaPy::makePocket(PyObject *args, PyObject *keywds)
{
- static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_POCKET), nullptr};
+ static const std::array kwlist {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_POCKET), nullptr};
short index = -1;
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_POCKET)
//Override pocket mode default
mode = Area::PocketModeZigZagOffset;
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"|h" PARAM_PY_KWDS(AREA_PARAMS_POCKET), kwlist,
- &index,PARAM_REF(PARAM_FARG,AREA_PARAMS_POCKET)))
+ &index,PARAM_REF(PARAM_FARG,AREA_PARAMS_POCKET))) {
return nullptr;
+ }
PY_TRY {
TopoDS_Shape resultShape = getAreaPtr()->makePocket(index,
@@ -352,18 +355,19 @@ PyObject* AreaPy::makePocket(PyObject *args, PyObject *keywds)
PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
{
- static char *kwlist[] = {PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SECTION_EXTRA),
+ static const std::array kwlist {PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SECTION_EXTRA),
"heights", "plane", nullptr};
PyObject *heights = nullptr;
PyObject *plane = nullptr;
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_SECTION_EXTRA)
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"|" PARAM_PY_KWDS(AREA_PARAMS_SECTION_EXTRA) "OO!", kwlist,
PARAM_REF(PARAM_FARG,AREA_PARAMS_SECTION_EXTRA),
- &heights, &(Part::TopoShapePy::Type), &plane))
+ &heights, &(Part::TopoShapePy::Type), &plane)) {
return nullptr;
+ }
PY_TRY {
std::vector h;
@@ -455,7 +459,7 @@ PyObject* AreaPy::setDefaultParams(PyObject *, PyObject *)
PyObject* AreaPy::setParams(PyObject *args, PyObject *keywds)
{
- static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
+ static const std::array kwlist {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
//Declare variables defined in the NAME field of the CONF parameter list
PARAM_PY_DECLARE(PARAM_FNAME,AREA_PARAMS_CONF);
@@ -466,7 +470,7 @@ PyObject* AreaPy::setParams(PyObject *args, PyObject *keywds)
PARAM_FOREACH(AREA_SET,AREA_PARAMS_CONF)
//Parse arguments to overwrite CONF variables
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"|" PARAM_PY_KWDS(AREA_PARAMS_CONF), kwlist,
PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF)))
return nullptr;
diff --git a/src/Mod/Path/App/CommandPyImp.cpp b/src/Mod/Path/App/CommandPyImp.cpp
index d0547b2fa0..c5ec831dc5 100644
--- a/src/Mod/Path/App/CommandPyImp.cpp
+++ b/src/Mod/Path/App/CommandPyImp.cpp
@@ -27,6 +27,7 @@
#include
#include
+#include
// files generated out of CommandPy.xml
#include "CommandPy.h"
@@ -69,8 +70,8 @@ int CommandPy::PyInit(PyObject* args, PyObject* kwd)
{
PyObject *parameters = nullptr;
char *name = "";
- static char *kwlist[] = {"name", "parameters", nullptr};
- if ( PyArg_ParseTupleAndKeywords(args, kwd, "|sO!", kwlist, &name, &PyDict_Type, ¶meters) ) {
+ static const std::array kwlist {"name", "parameters", nullptr};
+ if (Base::Wrapped_ParseTupleAndKeywords(args, kwd, "|sO!", kwlist, &name, &PyDict_Type, ¶meters)) {
std::string sname(name);
boost::to_upper(sname);
try {
@@ -113,7 +114,8 @@ int CommandPy::PyInit(PyObject* args, PyObject* kwd)
}
PyErr_Clear(); // set by PyArg_ParseTuple()
- if ( PyArg_ParseTupleAndKeywords(args, kwd, "|sO!", kwlist, &name, &(Base::PlacementPy::Type), ¶meters) ) {
+ if (Base::Wrapped_ParseTupleAndKeywords(args, kwd, "|sO!", kwlist, &name, &(Base::PlacementPy::Type),
+ ¶meters)) {
std::string sname(name);
boost::to_upper(sname);
try {
diff --git a/src/Mod/Path/App/FeatureAreaPyImp.cpp b/src/Mod/Path/App/FeatureAreaPyImp.cpp
index ac2d4b479f..a4a49f3990 100644
--- a/src/Mod/Path/App/FeatureAreaPyImp.cpp
+++ b/src/Mod/Path/App/FeatureAreaPyImp.cpp
@@ -22,6 +22,7 @@
#include "PreCompiled.h"
+#include
#include
// inclusion of the generated files (generated out of FeatureAreaPy.xml)
@@ -50,7 +51,7 @@ PyObject* FeatureAreaPy::getArea(PyObject *args)
PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds)
{
- static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
+ static const std::array kwlist {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
//Declare variables defined in the NAME field of the CONF parameter list
PARAM_PY_DECLARE(PARAM_FNAME,AREA_PARAMS_CONF);
@@ -64,7 +65,7 @@ PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds)
PARAM_FOREACH(AREA_SET,AREA_PARAMS_CONF)
//Parse arguments to overwrite CONF variables
- if (!PyArg_ParseTupleAndKeywords(args, keywds,
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, keywds,
"|" PARAM_PY_KWDS(AREA_PARAMS_CONF), kwlist,
PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF)))
return nullptr;
diff --git a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp
index 7c96a661cb..ac7f62e0f2 100644
--- a/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp
+++ b/src/Mod/Path/PathSimulator/App/PathSimPyImp.cpp
@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include
+#include
#include
#include
@@ -57,10 +58,10 @@ int PathSimPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
PyObject* PathSimPy::BeginSimulation(PyObject * args, PyObject * kwds)
{
- static char *kwlist[] = { "stock", "resolution", nullptr };
+ static const std::array kwlist { "stock", "resolution", nullptr };
PyObject *pObjStock;
float resolution;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!f", kwlist, &(Part::TopoShapePy::Type), &pObjStock, &resolution))
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!f", kwlist, &(Part::TopoShapePy::Type), &pObjStock, &resolution))
return nullptr;
PathSim *sim = getPathSimPtr();
Part::TopoShape *stock = static_cast(pObjStock)->getTopoShapePtr();
@@ -107,11 +108,13 @@ PyObject* PathSimPy::GetResultMesh(PyObject * args)
PyObject* PathSimPy::ApplyCommand(PyObject * args, PyObject * kwds)
{
- static char *kwlist[] = { "position", "command", nullptr };
+ static const std::array kwlist { "position", "command", nullptr };
PyObject *pObjPlace;
PyObject *pObjCmd;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", kwlist, &(Base::PlacementPy::Type), &pObjPlace, &(Path::CommandPy::Type), &pObjCmd))
- return nullptr;
+ if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!O!", kwlist, &(Base::PlacementPy::Type), &pObjPlace,
+ &(Path::CommandPy::Type), &pObjCmd)) {
+ return nullptr;
+ }
PathSim *sim = getPathSimPtr();
Base::Placement *pos = static_cast(pObjPlace)->getPlacementPtr();
Path::Command *cmd = static_cast(pObjCmd)->getCommandPtr();