PyAPI: support building with the up-coming Python 3.12

- Account for new member in _PyArg_Parser.

- Many Python op-codes have been removed.
  For the moment these are disabled in is_opcode_secure.
  Some should be added back as intrinsics, noted in code-comments.
This commit is contained in:
Campbell Barton 2023-08-30 14:05:32 +10:00
parent 0db1664ba4
commit a6837ac517
31 changed files with 152 additions and 2 deletions

View File

@ -37,6 +37,7 @@ set(SRC
# header-only
python_utildefines.h
python_compat.h
)
set(LIB

View File

@ -16,6 +16,7 @@
#include "py_capi_utils.h"
#include "python_compat.h"
#include "python_utildefines.h"
#include "imbuf_py_api.h" /* own include */
@ -95,6 +96,7 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
static const char *_keywords[] = {"size", "method", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"(ii)" /* `size` */
"|$" /* Optional keyword only arguments. */
"O&" /* `method` */
@ -141,6 +143,7 @@ static PyObject *py_imbuf_crop(Py_ImBuf *self, PyObject *args, PyObject *kw)
static const char *_keywords[] = {"min", "max", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"(II)" /* `min` */
"(II)" /* `max` */
":crop",
@ -442,6 +445,7 @@ static PyObject *M_imbuf_new(PyObject * /*self*/, PyObject *args, PyObject *kw)
int size[2];
static const char *_keywords[] = {"size", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"(ii)" /* `size` */
":new",
_keywords,
@ -505,6 +509,7 @@ static PyObject *M_imbuf_load(PyObject * /*self*/, PyObject *args, PyObject *kw)
static const char *_keywords[] = {"filepath", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `filepath` */
":load",
_keywords,
@ -549,6 +554,7 @@ static PyObject *M_imbuf_write(PyObject * /*self*/, PyObject *args, PyObject *kw
static const char *_keywords[] = {"image", "filepath", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O!" /* `image` */
"|$" /* Optional keyword only arguments. */
"O&" /* `filepath` */

View File

@ -0,0 +1,25 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup pygen
* \brief header-only compatibility defines.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* Add `intialized` member for Python 3.12+. */
#if PY_VERSION_HEX >= 0x030c0000
# define PY_ARG_PARSER_HEAD_COMPAT() 0,
#else
# define PY_ARG_PARSER_HEAD_COMPAT()
#endif
#ifdef __cplusplus
}
#endif

View File

@ -19,6 +19,7 @@
#include "GPU_batch.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "gpu_py.h"
#include "gpu_py_element.h"
@ -56,6 +57,7 @@ static PyObject *pygpu_batch__tp_new(PyTypeObject * /*type*/, PyObject *args, Py
static const char *_keywords[] = {"type", "buf", "elem", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O&" /* `type` */
"O!" /* `buf` */
@ -257,6 +259,7 @@ static PyObject *pygpu_batch_draw_instanced(BPyGPUBatch *self, PyObject *args, P
static const char *_keywords[] = {"program", "instance_start", "instance_count", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O!" /* `program` */
"|$" /* Optional keyword only arguments. */
"i" /* `instance_start` */
@ -299,6 +302,7 @@ static PyObject *pygpu_batch_draw_range(BPyGPUBatch *self, PyObject *args, PyObj
static const char *_keywords[] = {"program", "elem_start", "elem_count", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O!" /* `program` */
"|$" /* Optional keyword only arguments. */
"i" /* `elem_start' */

View File

@ -16,6 +16,8 @@
#include "MEM_guardedalloc.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "gpu_py.h"
#include "gpu_py_element.h" /* own include */
@ -38,6 +40,7 @@ static PyObject *pygpu_IndexBuf__tp_new(PyTypeObject * /*type*/, PyObject *args,
static const char *_keywords[] = {"type", "seq", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"$O" /* `type` */
"&O" /* `seq` */
":IndexBuf.__new__",

View File

@ -19,7 +19,9 @@
#include "GPU_init_exit.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
#include "gpu_py.h"
@ -328,6 +330,7 @@ static PyObject *pygpu_framebuffer__tp_new(PyTypeObject * /*self*/, PyObject *ar
PyObject *color_attachements = nullptr;
static const char *_keywords[] = {"depth_slot", "color_slots", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O" /* `depth_slot` */
"O" /* `color_slots` */
@ -423,6 +426,7 @@ static PyObject *pygpu_framebuffer_clear(BPyGPUFrameBuffer *self, PyObject *args
static const char *_keywords[] = {"color", "depth", "stencil", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O" /* `color` */
"O" /* `depth` */
@ -542,6 +546,7 @@ static PyObject *pygpu_framebuffer_read_color(BPyGPUFrameBuffer *self,
static const char *_keywords[] = {
"x", "y", "xsize", "ysize", "channels", "slot", "format", "data", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `x` */
"i" /* `y` */
"i" /* `xsize` */
@ -643,6 +648,7 @@ static PyObject *pygpu_framebuffer_read_depth(BPyGPUFrameBuffer *self,
static const char *_keywords[] = {"x", "y", "xsize", "ysize", "data", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `x` */
"i" /* `y` */
"i" /* `xsize` */

View File

@ -35,6 +35,7 @@
#include "../mathutils/mathutils.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "gpu_py.h"
#include "gpu_py_texture.h"
@ -240,6 +241,7 @@ static PyObject *pygpu_offscreen_unbind(BPyGPUOffScreen *self, PyObject *args, P
static const char *_keywords[] = {"restore", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O&" /* `restore` */
":unbind",
@ -270,6 +272,7 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject * /*self*/, PyObject *args
static const char *_keywords[] = {"width", "height", "format", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `width` */
"i" /* `height` */
"|$" /* Optional keyword only arguments. */
@ -391,6 +394,7 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `scene` */
"O" /* `view_layer` */
"O" /* `view3d` */

View File

@ -18,7 +18,9 @@
#include "GPU_uniform_buffer.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
#include "gpu_py.h"
@ -109,6 +111,7 @@ static PyObject *pygpu_shader__tp_new(PyTypeObject * /*type*/, PyObject *args, P
static const char *_keywords[] = {
"vertexcode", "fragcode", "geocode", "libcode", "defines", "name", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `vertexcode` */
"s" /* `fragcode` */
"|$" /* Optional keyword only arguments. */
@ -881,6 +884,7 @@ static PyObject *pygpu_shader_from_builtin(PyObject * /*self*/, PyObject *args,
static const char *_keywords[] = {"shader_name", "config", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `shader_name` */
"|$" /* Optional keyword only arguments. */
"O&" /* `config` */

View File

@ -17,6 +17,7 @@
#include "intern/gpu_shader_create_info.hh"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "gpu_py_shader.h" /* own include */
@ -528,6 +529,7 @@ static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self,
static const char *_keywords[] = {"slot", "type", "name", "blend", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `slot` */
"O&" /* `type` */
"s" /* `name` */
@ -632,6 +634,7 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self,
static const char *_keywords[] = {"slot", "format", "type", "name", "qualifiers", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `slot` */
"O&" /* `format` */
"O&" /* `type` */
@ -815,6 +818,7 @@ static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self,
static const char *_keywords[] = {"type", "name", "size", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `type` */
"s" /* `name` */
"|" /* Optional arguments. */

View File

@ -23,6 +23,7 @@
#include "BKE_image.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "gpu_py.h"
#include "gpu_py_buffer.h"
@ -123,6 +124,7 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args,
static const char *_keywords[] = {"size", "layers", "is_cubemap", "format", "data", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `size` */
"|$" /* Optional keyword only arguments. */
"i" /* `layers` */
@ -333,6 +335,7 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
static const char *_keywords[] = {"format", "value", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"$" /* Keyword only arguments. */
"O&" /* `format` */
"O" /* `value` */

View File

@ -19,6 +19,7 @@
#include "GPU_uniform_buffer.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "gpu_py.h"
@ -67,6 +68,7 @@ static PyObject *pygpu_uniformbuffer__tp_new(PyTypeObject * /*self*/,
static const char *_keywords[] = {"data", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `data` */
":GPUUniformBuf.__new__",
_keywords,

View File

@ -16,6 +16,7 @@
#include "MEM_guardedalloc.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "gpu_py_vertex_buffer.h" /* own include */
@ -237,6 +238,7 @@ static PyObject *pygpu_vertbuf__tp_new(PyTypeObject * /*type*/, PyObject *args,
static const char *_keywords[] = {"format", "len", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O!" /* `format` */
"I" /* `len` */
":GPUVertBuf.__new__",
@ -273,6 +275,7 @@ static PyObject *pygpu_vertbuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, Py
static const char *_keywords[] = {"id", "data", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `id` */
"O" /* `data` */
":attr_fill",

View File

@ -12,6 +12,7 @@
#include <Python.h>
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "gpu_py_vertex_format.h" /* own include */
@ -91,6 +92,7 @@ static PyObject *pygpu_vertformat_attr_add(BPyGPUVertFormat *self, PyObject *arg
static const char *_keywords[] = {"id", "comp_type", "len", "fetch_mode", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"$" /* Keyword only arguments. */
"s" /* `id` */
"O&" /* `comp_type` */

View File

@ -49,6 +49,7 @@
#include "bpy_utils_units.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
/* external util modules */
@ -121,6 +122,7 @@ static PyObject *bpy_blend_paths(PyObject * /*self*/, PyObject *args, PyObject *
static const char *_keywords[] = {"absolute", "packed", "local", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O&" /* `absolute` */
"O&" /* `packed` */
@ -184,6 +186,7 @@ static PyObject *bpy_flip_name(PyObject * /*self*/, PyObject *args, PyObject *kw
static const char *_keywords[] = {"", "strip_digits", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s#" /* `name` */
"|$" /* Optional, keyword only arguments. */
"O&" /* `strip_digits` */
@ -225,6 +228,7 @@ static PyObject *bpy_user_resource(PyObject * /*self*/, PyObject *args, PyObject
static const char *_keywords[] = {"type", "path", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `type` */
"|$" /* Optional keyword only arguments. */
"O&" /* `path` */
@ -274,6 +278,7 @@ static PyObject *bpy_system_resource(PyObject * /*self*/, PyObject *args, PyObje
static const char *_keywords[] = {"type", "path", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `type` */
"|$" /* Optional keyword only arguments. */
"O&" /* `path` */
@ -327,6 +332,7 @@ static PyObject *bpy_resource_path(PyObject * /*self*/, PyObject *args, PyObject
static const char *_keywords[] = {"type", "major", "minor", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `type` */
"|$" /* Optional keyword only arguments. */
"i" /* `major` */
@ -367,6 +373,7 @@ static PyObject *bpy_driver_secure_code_test(PyObject * /*self*/, PyObject *args
const bool verbose = false;
static const char *_keywords[] = {"code", "namespace", "verbose", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O!" /* `expression` */
"|$" /* Optional keyword only arguments. */
"O!" /* `namespace` */

View File

@ -56,6 +56,7 @@
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#ifdef BUILD_DATE
@ -511,6 +512,7 @@ static PyObject *bpy_app_is_job_running(PyObject * /*self*/, PyObject *args, PyO
static const char *_keywords[] = {"job_type", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `job_type` */
":is_job_running",
_keywords,
@ -540,6 +542,7 @@ static PyObject *bpy_app_help_text(PyObject * /*self*/, PyObject *args, PyObject
bool all = false;
static const char *_keywords[] = {"all", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O&" /* `all` */
":help_text",

View File

@ -17,6 +17,7 @@
#include "BKE_icons.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "bpy_app_icons.h"
@ -43,6 +44,7 @@ static PyObject *bpy_app_icons_new_triangles(PyObject * /*self*/, PyObject *args
static const char *_keywords[] = {"range", "coords", "colors", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"(BB)" /* `range` */
"S" /* `coords` */
"S" /* `colors` */
@ -103,6 +105,7 @@ static PyObject *bpy_app_icons_new_triangles_from_file(PyObject * /*self*/,
static const char *_keywords[] = {"filepath", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `filepath` */
":new_triangles_from_file",
_keywords,
@ -134,6 +137,7 @@ static PyObject *bpy_app_icons_release(PyObject * /*self*/, PyObject *args, PyOb
int icon_id;
static const char *_keywords[] = {"icon_id", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"i" /* `icon_id` */
":release",
_keywords,

View File

@ -15,6 +15,7 @@
#include "bpy_app_timers.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
static double handle_returned_value(PyObject *function, PyObject *ret)
@ -96,6 +97,7 @@ static PyObject *bpy_app_timers_register(PyObject * /*self*/, PyObject *args, Py
static const char *_keywords[] = {"function", "first_interval", "persistent", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `function` */
"|$" /* Optional keyword only arguments. */
"d" /* `first_interval` */

View File

@ -305,6 +305,8 @@ static void pydriver_error(ChannelDriver *driver, const PathResolvedRNA *anim_rn
static bool is_opcode_secure(const int opcode)
{
/* TODO(@ideasman42): Handle intrinsic opcodes (`CALL_INTRINSIC_1` & `CALL_INTRINSIC_2`).
* For Python 3.12. */
# define OK_OP(op) \
case op: \
@ -317,13 +319,17 @@ static bool is_opcode_secure(const int opcode)
OK_OP(POP_TOP)
OK_OP(PUSH_NULL)
OK_OP(NOP)
# if PY_VERSION_HEX < 0x030c0000
OK_OP(UNARY_POSITIVE)
# endif
OK_OP(UNARY_NEGATIVE)
OK_OP(UNARY_NOT)
OK_OP(UNARY_INVERT)
OK_OP(BINARY_SUBSCR)
OK_OP(GET_LEN)
# if PY_VERSION_HEX < 0x030c0000
OK_OP(LIST_TO_TUPLE)
# endif
OK_OP(RETURN_VALUE)
OK_OP(SWAP)
OK_OP(BUILD_TUPLE)
@ -332,10 +338,12 @@ static bool is_opcode_secure(const int opcode)
OK_OP(BUILD_MAP)
OK_OP(COMPARE_OP)
OK_OP(JUMP_FORWARD)
# if PY_VERSION_HEX < 0x030c0000
OK_OP(JUMP_IF_FALSE_OR_POP)
OK_OP(JUMP_IF_TRUE_OR_POP)
OK_OP(POP_JUMP_FORWARD_IF_FALSE)
OK_OP(POP_JUMP_FORWARD_IF_TRUE)
# endif
OK_OP(LOAD_GLOBAL)
OK_OP(IS_OP)
OK_OP(CONTAINS_OP)
@ -343,8 +351,10 @@ static bool is_opcode_secure(const int opcode)
OK_OP(LOAD_FAST)
OK_OP(STORE_FAST)
OK_OP(DELETE_FAST)
# if PY_VERSION_HEX < 0x030c0000
OK_OP(POP_JUMP_FORWARD_IF_NOT_NONE)
OK_OP(POP_JUMP_FORWARD_IF_NONE)
# endif
OK_OP(BUILD_SLICE)
OK_OP(LOAD_DEREF)
OK_OP(STORE_DEREF)
@ -357,17 +367,23 @@ static bool is_opcode_secure(const int opcode)
OK_OP(DICT_MERGE)
OK_OP(DICT_UPDATE)
# endif
# if PY_VERSION_HEX < 0x030c0000
OK_OP(POP_JUMP_BACKWARD_IF_NOT_NONE)
OK_OP(POP_JUMP_BACKWARD_IF_NONE)
OK_OP(POP_JUMP_BACKWARD_IF_FALSE)
OK_OP(POP_JUMP_BACKWARD_IF_TRUE)
# endif
/* Special cases. */
OK_OP(LOAD_CONST) /* Ok because constants are accepted. */
OK_OP(LOAD_NAME) /* Ok, because `PyCodeObject.names` is checked. */
OK_OP(CALL) /* Ok, because we check its "name" before calling. */
OK_OP(KW_NAMES) /* Ok, because it's used for calling functions with keyword arguments. */
OK_OP(PRECALL) /* Ok, because it's used for calling. */
# if PY_VERSION_HEX < 0x030c0000
OK_OP(PRECALL) /* Ok, because it's used for calling. */
# endif
# else /* Python 3.10 and older. */

View File

@ -30,6 +30,7 @@
#include "bpy_rna.h"
#include "../generic/py_capi_rna.h"
#include "../generic/python_compat.h"
/* we may want to add, but not now */
@ -54,6 +55,7 @@ static bool bpy_gizmotype_target_property_def(wmGizmoType *gzt, PyObject *item)
static const char *const _keywords[] = {"id", "type", "array_length", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"s" /* `id` */
"O&" /* `type` */

View File

@ -39,6 +39,7 @@
#include "bpy_library.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
/* nifty feature. swap out strings for RNA data */
@ -202,6 +203,7 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `filepath` */
/* Optional keyword only arguments. */
"|$"

View File

@ -32,6 +32,7 @@
#include "bpy_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
PyDoc_STRVAR(
bpy_lib_write_doc,
@ -86,6 +87,7 @@ static PyObject *bpy_lib_write(BPy_PropertyRNA *self, PyObject *args, PyObject *
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `filepath` */
"O!" /* `datablocks` */
"|$" /* Optional keyword only arguments. */

View File

@ -11,7 +11,9 @@
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
#include "BLI_utildefines.h"
@ -243,6 +245,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject * /*self*/, PyObject *args, P
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `key` */
"O" /* `owner` */
"O!" /* `args` */
@ -344,6 +347,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject * /*self*/, PyObject *args, PyO
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `key` */
":publish_rna",
_keywords,

View File

@ -22,7 +22,9 @@
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "BPY_extern.h"
#include "bpy_capi_utils.h"
#include "bpy_operator.h"
@ -83,6 +85,7 @@ static PyObject *pyop_poll(PyObject * /*self*/, PyObject *args)
/* All arguments are positional. */
static const char *_keywords[] = {"", "", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `opname` */
"|" /* Optional arguments. */
"s" /* `context_str` */
@ -153,6 +156,7 @@ static PyObject *pyop_call(PyObject * /*self*/, PyObject *args)
/* All arguments are positional. */
static const char *_keywords[] = {"", "", "", "", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `opname` */
"|" /* Optional arguments. */
"O!" /* `kw` */
@ -323,6 +327,7 @@ static PyObject *pyop_as_string(PyObject * /*self*/, PyObject *args)
/* All arguments are positional. */
static const char *_keywords[] = {"", "", "", "", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `opname` */
"|" /* Optional arguments. */
"O!" /* `kw` */

View File

@ -37,6 +37,7 @@
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
/* Disabled duplicating strings because the array can still be freed and
* the strings from it referenced, for now we can't support dynamically
@ -1605,6 +1606,7 @@ static bool bpy_prop_string_visit_fn_call(PyObject *py_func,
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `text` */
"s" /* `info` */
":search",
@ -2837,6 +2839,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -2996,6 +2999,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -3186,6 +3190,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -3356,6 +3361,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
"get", "set", nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -3553,6 +3559,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
"update", "get", "set", nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -3737,6 +3744,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -3947,6 +3955,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"|$" /* Optional, keyword only arguments. */
"s" /* `name` */
@ -4152,6 +4161,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"O" /* `items` */
"|$" /* Optional, keyword only arguments. */
@ -4380,6 +4390,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"O" /* `type` */
"|$" /* Optional, keyword only arguments. */
@ -4522,6 +4533,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `attr` */
"O" /* `type` */
"|$" /* Optional, keyword only arguments. */
@ -4640,6 +4652,7 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `attr` */
":RemoveProperty",
_keywords,

View File

@ -66,6 +66,7 @@
#include "../generic/idprop_py_ui_api.h"
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#define USE_PEDANTIC_WRITE
@ -3632,6 +3633,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
static const char *_keywords[] = {"", "ghost", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `name` (positional). */
"|$" /* Optional keyword only arguments. */
"O&" /* `ghost` */
@ -4017,7 +4019,7 @@ static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
static PyObject *pyrna_struct_bl_rna_find_subclass_recursive(PyObject *cls, const char *id)
{
PyObject *ret_test = nullptr;
PyObject *subclasses = ((PyTypeObject *)cls)->tp_subclasses;
PyObject *subclasses = (PyObject *)((PyTypeObject *)cls)->tp_subclasses;
if (subclasses) {
/* Unfortunately we can't use the dict key because Python class names
* don't match the bl_idname used internally. */

View File

@ -20,6 +20,8 @@
#include "bpy_rna_context.h"
#include "../generic/python_compat.h"
#include "RNA_access.hh"
#include "RNA_prototypes.h"
@ -335,6 +337,7 @@ static PyObject *bpy_context_temp_override(PyObject *self, PyObject *args, PyObj
static const char *const _keywords[] = {"window", "area", "region", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional, keyword only arguments. */
"O&" /* `window` */
"O&" /* `area` */

View File

@ -17,6 +17,7 @@
#include <cstddef>
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@ -143,6 +144,7 @@ static PyObject *bpy_rna_data_temp_data(PyObject * /*self*/, PyObject *args, PyO
BPy_DataContext *ret;
static const char *_keywords[] = {"filepath", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O&" /* `filepath` */
":temp_data",

View File

@ -23,6 +23,7 @@
#include "bpy_rna_gizmo.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "RNA_access.hh"
@ -347,6 +348,7 @@ static PyObject *bpy_gizmo_target_set_handler(PyObject * /*self*/, PyObject *arg
* (see: rna_wm_gizmo_api.cc). conventions should match. */
static const char *const _keywords[] = {"self", "target", "get", "set", "range", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `self` */
"O&" /* `target` */
"|$" /* Optional keyword only arguments. */
@ -450,6 +452,7 @@ static PyObject *bpy_gizmo_target_get_value(PyObject * /*self*/, PyObject *args,
static const char *const _keywords[] = {"self", "target", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `self` */
"O&" /* `target` */
":target_get_value",
@ -520,6 +523,7 @@ static PyObject *bpy_gizmo_target_set_value(PyObject * /*self*/, PyObject *args,
static const char *const _keywords[] = {"self", "target", "value", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `self` */
"O&" /* `target` */
"O" /* `value` */
@ -603,6 +607,7 @@ static PyObject *bpy_gizmo_target_get_range(PyObject * /*self*/, PyObject *args,
static const char *const _keywords[] = {"self", "target", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O&" /* `self` */
"O&" /* `target` */
":target_get_range",

View File

@ -35,6 +35,7 @@
#include "../generic/py_capi_rna.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "../generic/python_utildefines.h"
#include "RNA_access.hh"
@ -161,6 +162,7 @@ static PyObject *bpy_user_map(PyObject * /*self*/, PyObject *args, PyObject *kwd
static const char *_keywords[] = {"subset", "key_types", "value_types", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"O" /* `subset` */
"O!" /* `key_types` */
@ -304,6 +306,7 @@ static PyObject *bpy_batch_remove(PyObject * /*self*/, PyObject *args, PyObject
static const char *_keywords[] = {"ids", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"O" /* `ids` */
":batch_remove",
_keywords,
@ -382,6 +385,7 @@ static PyObject *bpy_orphans_purge(PyObject * /*self*/, PyObject *args, PyObject
static const char *_keywords[] = {"do_local_ids", "do_linked_ids", "do_recursive", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|" /* Optional arguments. */
"O&" /* `do_local_ids` */
"O&" /* `do_linked_ids` */

View File

@ -20,6 +20,8 @@
#include "BKE_text.h"
#include "../generic/python_compat.h"
#include "bpy_capi_utils.h"
#include "bpy_rna.h"
#include "bpy_rna_text.h"
@ -66,6 +68,7 @@ static PyObject *bpy_rna_region_as_string(PyObject *self, PyObject *args, PyObje
static const char *_keywords[] = {"range", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"|$" /* Optional keyword only arguments. */
"((ii)(ii))" /* `range` */
":region_as_string",
@ -133,6 +136,7 @@ static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args, PyOb
static const char *_keywords[] = {"", "range", nullptr};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s#" /* `buf` (positional). */
"|$" /* Optional keyword only arguments. */
"((ii)(ii))" /* `range` */

View File

@ -21,6 +21,7 @@
#include "bpy_utils_units.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_compat.h"
#include "BKE_unit.h"
@ -178,6 +179,7 @@ static PyObject *bpyunits_to_value(PyObject * /*self*/, PyObject *args, PyObject
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `unit_system` */
"s" /* `unit_category` */
"s#" /* `str_input` */
@ -265,6 +267,7 @@ static PyObject *bpyunits_to_string(PyObject * /*self*/, PyObject *args, PyObjec
nullptr,
};
static _PyArg_Parser _parser = {
PY_ARG_PARSER_HEAD_COMPAT()
"s" /* `unit_system` */
"s" /* `unit_category` */
"d" /* `value` */