diff --git a/src/Base/PyWrapParseTupleAndKeywords.h b/src/Base/PyWrapParseTupleAndKeywords.h index 3b1d151b9b..9a5400ccc7 100644 --- a/src/Base/PyWrapParseTupleAndKeywords.h +++ b/src/Base/PyWrapParseTupleAndKeywords.h @@ -44,6 +44,8 @@ namespace Base { const std::array keywords, ...) { + static_assert(arraySize > 0, "keywords array must have at least a single nullptr in it"); + // NOTE: This code is from getargs.c in the Python source code (modified to use the public interface at // PyArg_VaParseTupleAndKeywords and to return a bool). va_list va; // NOLINT @@ -51,7 +53,6 @@ namespace Base { if ((args == nullptr || !PyTuple_Check(args)) || (kw != nullptr && !PyDict_Check(kw)) || format == nullptr || - keywords.empty() || // It must at least have a single nullptr in it (TODO: compilation error instead) keywords.back() != nullptr) // It must END with a nullptr { PyErr_BadInternalCall();