[Bf-blender-cvs] [29e96158b99] blender2.8: Icons: correct arg parsing
Campbell Barton
noreply at git.blender.org
Thu Apr 26 15:19:59 CEST 2018
Commit: 29e96158b9939035ad46e77a07f29807de843ec2
Author: Campbell Barton
Date: Thu Apr 26 15:18:00 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB29e96158b9939035ad46e77a07f29807de843ec2
Icons: correct arg parsing
Use _PyArg_ParseTupleAndKeywordsFast
===================================================================
M source/blender/python/intern/bpy_app_icons.c
===================================================================
diff --git a/source/blender/python/intern/bpy_app_icons.c b/source/blender/python/intern/bpy_app_icons.c
index 6d3b50d5688..4bd059dd295 100644
--- a/source/blender/python/intern/bpy_app_icons.c
+++ b/source/blender/python/intern/bpy_app_icons.c
@@ -51,13 +51,16 @@ PyDoc_STRVAR(bpy_app_icons_new_triangles_doc,
" :return: Unique icon value (pass to interface ``icon_value`` argument).\n"
" :rtype: int\n"
);
-static PyObject *bpy_app_icons_new_triangles(PyObject *UNUSED(self), PyObject *args)
+static PyObject *bpy_app_icons_new_triangles(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
/* bytes */
uchar coords_range[2];
PyObject *py_coords, *py_colors;
- if (!PyArg_ParseTuple(
- args, "(BB)SS:new_triangles",
+
+ static const char *_keywords[] = {"range", "coords", "colors", NULL};
+ static _PyArg_Parser _parser = {"(BB)SS:new_triangles", _keywords, 0};
+ if (!_PyArg_ParseTupleAndKeywordsFast(
+ args, kw, &_parser,
&coords_range[0], &coords_range[1], &py_coords, &py_colors))
{
return NULL;
@@ -103,12 +106,15 @@ PyDoc_STRVAR(bpy_app_icons_new_triangles_from_file_doc,
" :return: Unique icon value (pass to interface ``icon_value`` argument).\n"
" :rtype: int\n"
);
-static PyObject *bpy_app_icons_new_triangles_from_file(PyObject *UNUSED(self), PyObject *args)
+static PyObject *bpy_app_icons_new_triangles_from_file(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
/* bytes */
char *filename;
- if (!PyArg_ParseTuple(
- args, "s:new_triangles_from_file",
+
+ static const char *_keywords[] = {"filename", NULL};
+ static _PyArg_Parser _parser = {"s:new_triangles_from_file", _keywords, 0};
+ if (!_PyArg_ParseTupleAndKeywordsFast(
+ args, kw, &_parser,
&filename))
{
return NULL;
@@ -128,13 +134,14 @@ PyDoc_STRVAR(bpy_app_icons_release_doc,
"\n"
" Release the icon.\n"
);
-static PyObject *bpy_app_icons_release(PyObject *UNUSED(self), PyObject *args)
+static PyObject *bpy_app_icons_release(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
int icon_id;
- static _PyArg_Parser _parser = {"i:release", NULL, 0};
+ static const char *_keywords[] = {"icon_id", NULL};
+ static _PyArg_Parser _parser = {"i:release", _keywords, 0};
if (!_PyArg_ParseTupleAndKeywordsFast(
- args, NULL, &_parser,
- &icon_id))
+ args, kw, &_parser,
+ &icon_id))
{
return NULL;
}
@@ -147,9 +154,12 @@ static PyObject *bpy_app_icons_release(PyObject *UNUSED(self), PyObject *args)
}
static struct PyMethodDef M_AppIcons_methods[] = {
- {"new_triangles", (PyCFunction)bpy_app_icons_new_triangles, METH_VARARGS, bpy_app_icons_new_triangles_doc},
- {"new_triangles_from_file", (PyCFunction)bpy_app_icons_new_triangles_from_file, METH_VARARGS, bpy_app_icons_new_triangles_from_file_doc},
- {"release", (PyCFunction)bpy_app_icons_release, METH_VARARGS, bpy_app_icons_release_doc},
+ {"new_triangles", (PyCFunction)bpy_app_icons_new_triangles,
+ METH_VARARGS | METH_KEYWORDS, bpy_app_icons_new_triangles_doc},
+ {"new_triangles_from_file", (PyCFunction)bpy_app_icons_new_triangles_from_file,
+ METH_VARARGS | METH_KEYWORDS, bpy_app_icons_new_triangles_from_file_doc},
+ {"release", (PyCFunction)bpy_app_icons_release,
+ METH_VARARGS | METH_KEYWORDS, bpy_app_icons_release_doc},
{NULL, NULL, 0, NULL}
};
More information about the Bf-blender-cvs
mailing list