PyAPI: use faster argument parsing for internal bpy.ops call & poll
No functional changes.
This commit is contained in:
@@ -78,7 +78,17 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|s:_bpy.ops.poll", &opname, &context_str)) {
|
||||
/* All arguments are positional. */
|
||||
static const char *_keywords[] = {"", "", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
"s" /* `opname` */
|
||||
"|" /* Optional arguments. */
|
||||
"s" /* `context_str` */
|
||||
":_bpy.ops.poll",
|
||||
_keywords,
|
||||
0,
|
||||
};
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args, NULL, &_parser, &opname, &context_str)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -138,8 +148,20 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(
|
||||
args, "s|O!si:_bpy.ops.call", &opname, &PyDict_Type, &kw, &context_str, &is_undo))
|
||||
/* All arguments are positional. */
|
||||
static const char *_keywords[] = {"", "", "", "", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
"s" /* `opname` */
|
||||
"|" /* Optional arguments. */
|
||||
"O!" /* `kw` */
|
||||
"s" /* `context_str` */
|
||||
"i" /* `is_undo` */
|
||||
":_bpy.ops.call",
|
||||
_keywords,
|
||||
0,
|
||||
};
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||
args, NULL, &_parser, &opname, &PyDict_Type, &kw, &context_str, &is_undo))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -296,15 +318,28 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args,
|
||||
"s|O!O&O&:_bpy.ops.as_string",
|
||||
&opname,
|
||||
&PyDict_Type,
|
||||
&kw,
|
||||
PyC_ParseBool,
|
||||
&all_args,
|
||||
PyC_ParseBool,
|
||||
¯o_args))
|
||||
/* All arguments are positional. */
|
||||
static const char *_keywords[] = {"", "", "", "", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
"s" /* `opname` */
|
||||
"|" /* Optional arguments. */
|
||||
"O!" /* `kw` */
|
||||
"O&" /* `all_args` */
|
||||
"O&" /* `macro_args` */
|
||||
":_bpy.ops.as_string",
|
||||
_keywords,
|
||||
0,
|
||||
};
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||
NULL,
|
||||
&_parser,
|
||||
&opname,
|
||||
&PyDict_Type,
|
||||
&kw,
|
||||
PyC_ParseBool,
|
||||
&all_args,
|
||||
PyC_ParseBool,
|
||||
¯o_args))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user