diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-08 02:41:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-08 04:49:50 +0300 |
commit | 982aea88e0d74020c62c2054a45eeafa56c8ca30 (patch) | |
tree | 6215fe088028a0943ace5ea80e256b7a42132420 /source/blender/python/gpu/gpu_py_texture.c | |
parent | 87a3bf33564b035e4c2400098ea4932d5dfdba5d (diff) |
Cleanup: separate format-units for Python argument parsing
With the increased use of multi-character format units and keyword-only
arguments these are increasingly difficult to make sense of.
Split the string onto multiple lines, one per argument.
While verbose it's easier to understand and add new arguments.
Diffstat (limited to 'source/blender/python/gpu/gpu_py_texture.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_texture.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/python/gpu/gpu_py_texture.c b/source/blender/python/gpu/gpu_py_texture.c index 59896dbca2a..7a23f7ac91f 100644 --- a/source/blender/python/gpu/gpu_py_texture.c +++ b/source/blender/python/gpu/gpu_py_texture.c @@ -122,7 +122,17 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject *UNUSED(self), PyObject *arg char err_out[256] = "unknown error. See console"; static const char *_keywords[] = {"size", "layers", "is_cubemap", "format", "data", NULL}; - static _PyArg_Parser _parser = {"O|$ipO&O!:GPUTexture.__new__", _keywords, 0}; + static _PyArg_Parser _parser = { + "O" /* `size` */ + "|$" /* Optional keyword only arguments. */ + "i" /* `layers` */ + "p" /* `is_cubemap` */ + "O&" /* `format` */ + "O!" /* `data` */ + ":GPUTexture.__new__", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, @@ -288,7 +298,14 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje PyObject *py_values; static const char *_keywords[] = {"format", "value", NULL}; - static _PyArg_Parser _parser = {"$O&O:clear", _keywords, 0}; + static _PyArg_Parser _parser = { + "$" /* Keyword only arguments. */ + "O&" /* `format` */ + "O" /* `value` */ + ":clear", + _keywords, + 0, + }; if (!_PyArg_ParseTupleAndKeywordsFast( args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_dataformat, &py_values)) { return NULL; |