Commit: 927cb5bfacadd4ce23643a37b6429487d11ec4a9
Author: Campbell Barton
Date:   Thu Apr 14 11:21:51 2022 +1000
Branches: master
https://developer.blender.org/rB927cb5bfacadd4ce23643a37b6429487d11ec4a9

Cleanup: separate format-units for Python argument parsing

Recent addition to the Python API [0] didn't follow this convention.
See [1] for the rationale behind this change.

[0]: 9bc678969aaef5e2343d9362648e9a633d1b6e5e
[1]: 982aea88e0d74020c62c2054a45eeafa56c8ca30

===================================================================

M       source/blender/python/gpu/gpu_py_shader_create_info.cc

===================================================================

diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc 
b/source/blender/python/gpu/gpu_py_shader_create_info.cc
index ab2bdf33b26..3b043c605fa 100644
--- a/source/blender/python/gpu/gpu_py_shader_create_info.cc
+++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc
@@ -483,7 +483,16 @@ static PyObject 
*pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self,
   struct PyC_StringEnum blend_type = {pygpu_dualblend_items, 
(int)DualBlend::NONE};
 
   static const char *_keywords[] = {"slot", "type", "name", "blend", nullptr};
-  static _PyArg_Parser _parser = {"iO&s|$O&:fragment_out", _keywords, nullptr};
+  static _PyArg_Parser _parser = {
+      "i"  /* `slot` */
+      "O&" /* `type` */
+      "s"  /* `name` */
+      "|$" /* Optional keyword only arguments. */
+      "O&" /* `blend` */
+      ":fragment_out",
+      _keywords,
+      nullptr,
+  };
   if (!_PyArg_ParseTupleAndKeywordsFast(args,
                                         kwds,
                                         &_parser,
@@ -577,7 +586,17 @@ static PyObject 
*pygpu_shader_info_image(BPyGPUShaderCreateInfo *self,
   Qualifier qualifier = Qualifier::NO_RESTRICT;
 
   static const char *_keywords[] = {"slot", "format", "type", "name", 
"qualifiers", nullptr};
-  static _PyArg_Parser _parser = {"iO&O&s|$O:image", _keywords, 0};
+  static _PyArg_Parser _parser = {
+      "i"  /* `slot` */
+      "O&" /* `format` */
+      "O&" /* `type` */
+      "s"  /* `name` */
+      "|$" /* Optional keyword only arguments. */
+      "O"  /* `qualifiers` */
+      ":image",
+      _keywords,
+      nullptr,
+  };
   if (!_PyArg_ParseTupleAndKeywordsFast(args,
                                         kwds,
                                         &_parser,
@@ -733,7 +752,15 @@ static PyObject 
*pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self,
   int array_size = 0;
 
   static const char *_keywords[] = {"type", "name", "size", nullptr};
-  static _PyArg_Parser _parser = {"O&s|I:push_constant", _keywords, nullptr};
+  static _PyArg_Parser _parser = {
+      "O&" /* `type` */
+      "s"  /* `name` */
+      "|"  /* Optional arguments. */
+      "I"  /* `size` */
+      ":push_constant",
+      _keywords,
+      nullptr,
+  };
   if (!_PyArg_ParseTupleAndKeywordsFast(
           args, kwds, &_parser, PyC_ParseStringEnum, &pygpu_type, &name, 
&array_size)) {
     return nullptr;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to