Merge branch 'blender-v4.3-release'
This commit is contained in:
@@ -621,12 +621,12 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
||||
break;
|
||||
case BMO_OP_SLOT_PTR:
|
||||
BLI_assert(0); /* currently we don't have any pointer return values in use */
|
||||
item = Py_INCREF_RET(Py_None);
|
||||
item = Py_NewRef(Py_None);
|
||||
break;
|
||||
case BMO_OP_SLOT_ELEMENT_BUF: {
|
||||
if (slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) {
|
||||
BMHeader *ele = static_cast<BMHeader *>(BMO_slot_buffer_get_single(slot));
|
||||
item = ele ? BPy_BMElem_CreatePyObject(bm, ele) : Py_INCREF_RET(Py_None);
|
||||
item = ele ? BPy_BMElem_CreatePyObject(bm, ele) : Py_NewRef(Py_None);
|
||||
}
|
||||
else {
|
||||
const int size = slot->len;
|
||||
@@ -731,7 +731,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
|
||||
}
|
||||
case BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
|
||||
/* can't convert from these */
|
||||
item = Py_INCREF_RET(Py_None);
|
||||
item = Py_NewRef(Py_None);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -811,7 +811,7 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
|
||||
ret = nullptr; /* exception raised above */
|
||||
}
|
||||
else if (bmop.slots_out[0].slot_name == nullptr) {
|
||||
ret = Py_INCREF_RET(Py_None);
|
||||
ret = Py_NewRef(Py_None);
|
||||
}
|
||||
else {
|
||||
/* build return value */
|
||||
@@ -827,7 +827,7 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
|
||||
/* this function doesn't throw exceptions */
|
||||
item = bpy_slot_to_py(bm, slot);
|
||||
if (item == nullptr) {
|
||||
item = Py_INCREF_RET(Py_None);
|
||||
item = Py_NewRef(Py_None);
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
@@ -726,7 +726,7 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject
|
||||
return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
static PyMethodDef bpy_bmlayeritem_methods[] = {
|
||||
|
||||
@@ -731,7 +731,7 @@ static PyObject *bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
|
||||
return PyFloat_FromDouble(dw->weight);
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
||||
@@ -1703,7 +1703,7 @@ static PyObject *BPy_IDGroup_pop(BPy_IDProperty *self, PyObject *args)
|
||||
PyErr_SetString(PyExc_KeyError, "item not in group");
|
||||
return nullptr;
|
||||
}
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
pyform = BPy_IDGroup_MapDataToPy(idprop);
|
||||
@@ -1726,7 +1726,7 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len,
|
||||
|
||||
/* fill rest of list with valid references to None */
|
||||
for (j = len; j < prop->len; j++) {
|
||||
PyList_SET_ITEM(seq, j, Py_INCREF_RET(Py_None));
|
||||
PyList_SET_ITEM(seq, j, Py_NewRef(Py_None));
|
||||
}
|
||||
|
||||
/* Set correct group length. */
|
||||
|
||||
@@ -1230,7 +1230,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
|
||||
PyList_SET_ITEM(values, i, Py_INCREF_RET(Py_None)); /* hold user */
|
||||
PyList_SET_ITEM(values, i, Py_NewRef(Py_None)); /* hold user */
|
||||
|
||||
sizes[i] = 0;
|
||||
}
|
||||
|
||||
@@ -20,16 +20,6 @@
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/**
|
||||
* Wrap #Py_INCREF & return the result,
|
||||
* use sparingly to avoid comma operator or temp var assignment.
|
||||
*/
|
||||
Py_LOCAL_INLINE(PyObject *) Py_INCREF_RET(PyObject *op)
|
||||
{
|
||||
Py_INCREF(op);
|
||||
return op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append & transfer ownership to the list,
|
||||
* avoids inline #Py_DECREF all over (which is quite a large macro).
|
||||
|
||||
@@ -353,7 +353,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject * /*self*/, void * /*closure*/
|
||||
}
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(bpy_pydriver_Dict);
|
||||
return Py_NewRef(bpy_pydriver_Dict);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
||||
@@ -379,11 +379,11 @@ void bpy_app_generic_callback(Main * /*main*/,
|
||||
args_all, i, pyrna_struct_CreatePyObject_with_primitive_support(pointers[i]));
|
||||
}
|
||||
for (int i = pointers_num; i < num_arguments; ++i) {
|
||||
PyTuple_SET_ITEM(args_all, i, Py_INCREF_RET(Py_None));
|
||||
PyTuple_SET_ITEM(args_all, i, Py_NewRef(Py_None));
|
||||
}
|
||||
|
||||
if (pointers_num == 0) {
|
||||
PyTuple_SET_ITEM(args_single, 0, Py_INCREF_RET(Py_None));
|
||||
PyTuple_SET_ITEM(args_single, 0, Py_NewRef(Py_None));
|
||||
}
|
||||
else {
|
||||
PyTuple_SET_ITEM(
|
||||
|
||||
@@ -440,8 +440,7 @@ static PyObject *app_translations_contexts_make()
|
||||
|
||||
#define SetObjString(item) \
|
||||
PyStructSequence_SET_ITEM(translations_contexts, pos++, PyUnicode_FromString(item))
|
||||
#define SetObjNone() \
|
||||
PyStructSequence_SET_ITEM(translations_contexts, pos++, Py_INCREF_RET(Py_None))
|
||||
#define SetObjNone() PyStructSequence_SET_ITEM(translations_contexts, pos++, Py_NewRef(Py_None))
|
||||
|
||||
for (ctxt = _contexts; ctxt->c_id; ctxt++) {
|
||||
if (ctxt->value) {
|
||||
@@ -575,7 +574,7 @@ static PyObject *_py_pgettext(PyObject *args,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(msgid);
|
||||
return Py_NewRef(msgid);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -644,7 +643,7 @@ static PyObject *app_translations_pgettext_n(BlenderAppTranslations * /*self*/,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(msgid);
|
||||
return Py_NewRef(msgid);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
||||
@@ -238,7 +238,7 @@ static PyObject *bpy_cli_command_register(PyObject * /*self*/, PyObject *args, P
|
||||
const char *id = PyUnicode_AsUTF8(py_id);
|
||||
|
||||
std::unique_ptr<CommandHandler> cmd_ptr = std::make_unique<BPyCommandHandler>(
|
||||
std::string(id), Py_INCREF_RET(py_exec_fn));
|
||||
std::string(id), Py_NewRef(py_exec_fn));
|
||||
void *cmd_p = cmd_ptr.get();
|
||||
|
||||
BKE_blender_cli_command_register(std::move(cmd_ptr));
|
||||
|
||||
@@ -447,7 +447,7 @@ static bool bpy_lib_exit_lapp_context_items_cb(BlendfileLinkAppendContext *lapp_
|
||||
|
||||
bpy_lib_exit_warn_idname(data.py_library, idcode_name_plural, item_idname);
|
||||
|
||||
py_item = Py_INCREF_RET(Py_None);
|
||||
py_item = Py_NewRef(Py_None);
|
||||
}
|
||||
|
||||
PyList_SET_ITEM(data.py_list, py_list_index, py_item);
|
||||
@@ -519,7 +519,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject * /*args*/)
|
||||
|
||||
#ifdef USE_RNA_DATABLOCKS
|
||||
/* We can replace the item immediately with `None`. */
|
||||
PyObject *py_item = Py_INCREF_RET(Py_None);
|
||||
PyObject *py_item = Py_NewRef(Py_None);
|
||||
PyList_SET_ITEM(ls, i, py_item);
|
||||
Py_DECREF(item_src);
|
||||
#endif
|
||||
|
||||
@@ -303,7 +303,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject * /*self*/, PyObject *args, P
|
||||
|
||||
{
|
||||
PyObject *user_data = PyTuple_New(2);
|
||||
PyTuple_SET_ITEMS(user_data, Py_INCREF_RET(callback_args), Py_INCREF_RET(callback_notify));
|
||||
PyTuple_SET_ITEMS(user_data, Py_NewRef(callback_args), Py_NewRef(callback_notify));
|
||||
msg_val_params.user_data = user_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ static PyObject *pyop_poll(PyObject * /*self*/, PyObject *args)
|
||||
/* main purpose of this function */
|
||||
ret = WM_operator_poll_context((bContext *)C, ot, context) ? Py_True : Py_False;
|
||||
|
||||
return Py_INCREF_RET(ret);
|
||||
return Py_NewRef(ret);
|
||||
}
|
||||
|
||||
static PyObject *pyop_call(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
@@ -855,7 +855,7 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
|
||||
@@ -886,7 +886,7 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
/*----------------------repr--------------------------------------------*/
|
||||
@@ -4114,7 +4114,7 @@ static PyObject *pyrna_struct_bl_rna_get_subclass_py(PyObject *cls, PyObject *ar
|
||||
if (ret == nullptr) {
|
||||
ret = ret_default;
|
||||
}
|
||||
return Py_INCREF_RET(ret);
|
||||
return Py_NewRef(ret);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
@@ -4160,7 +4160,7 @@ static PyObject *pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(ret_default);
|
||||
return Py_NewRef(ret_default);
|
||||
}
|
||||
|
||||
static void pyrna_dir_members_py__add_keys(PyObject *list, PyObject *dict)
|
||||
@@ -5169,7 +5169,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
@@ -5225,7 +5225,7 @@ static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
|
||||
PyErr_SetString(PyExc_KeyError, "key not found");
|
||||
return nullptr;
|
||||
}
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
@@ -5296,7 +5296,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
|
||||
Py_TYPE(key_ob)->tp_name);
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(def);
|
||||
return Py_NewRef(def);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
@@ -6237,7 +6237,7 @@ static PyObject *pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject * /
|
||||
}
|
||||
|
||||
if (type == Py_TYPE(base)) {
|
||||
return Py_INCREF_RET((PyObject *)base);
|
||||
return Py_NewRef(base);
|
||||
}
|
||||
if (PyType_IsSubtype(type, &pyrna_prop_Type)) {
|
||||
BPy_PropertyRNA *ret = (BPy_PropertyRNA *)type->tp_alloc(type, 0);
|
||||
@@ -7560,7 +7560,7 @@ static PyObject *pyrna_srna_Subtype(StructRNA *srna)
|
||||
|
||||
/* arg[1] (bases=...) */
|
||||
PyTuple_SET_ITEM(args, 1, item = PyTuple_New(1));
|
||||
PyTuple_SET_ITEM(item, 0, Py_INCREF_RET(py_base));
|
||||
PyTuple_SET_ITEM(item, 0, Py_NewRef(py_base));
|
||||
|
||||
/* arg[2] (dict=...) */
|
||||
PyTuple_SET_ITEM(args, 2, item = PyDict_New());
|
||||
|
||||
@@ -128,7 +128,7 @@ static PyObject *BPY_rna_operator_poll_message_set(PyObject * /*self*/, PyObject
|
||||
bContextPollMsgDyn_Params params{};
|
||||
params.get_fn = pyop_poll_message_get_fn;
|
||||
params.free_fn = pyop_poll_message_free_fn;
|
||||
params.user_data = Py_INCREF_RET(args);
|
||||
params.user_data = Py_NewRef(args);
|
||||
|
||||
CTX_wm_operator_poll_msg_set_dynamic(C, ¶ms);
|
||||
|
||||
|
||||
@@ -619,7 +619,7 @@ char BaseMathObject_owner_doc[] = "The item this is wrapping or None (read-only
|
||||
PyObject *BaseMathObject_owner_get(BaseMathObject *self, void * /*closure*/)
|
||||
{
|
||||
PyObject *ret = self->cb_user ? self->cb_user : Py_None;
|
||||
return Py_INCREF_RET(ret);
|
||||
return Py_NewRef(ret);
|
||||
}
|
||||
|
||||
char BaseMathObject_is_wrapped_doc[] =
|
||||
@@ -660,7 +660,7 @@ PyObject *BaseMathObject_freeze(BaseMathObject *self)
|
||||
|
||||
self->flag |= BASE_MATH_FLAG_IS_FROZEN;
|
||||
|
||||
return Py_INCREF_RET((PyObject *)self);
|
||||
return Py_NewRef(self);
|
||||
}
|
||||
|
||||
int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg)
|
||||
|
||||
@@ -344,7 +344,7 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -426,7 +426,7 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -2419,7 +2419,7 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -899,7 +899,7 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py_INCREF_RET(res);
|
||||
return Py_NewRef(res);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -277,7 +277,7 @@ static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject * /*self*/, PyOb
|
||||
(dist < FLT_EPSILON))
|
||||
{
|
||||
/* out of range */
|
||||
PyTuple_SET_ITEMS(ret, Py_INCREF_RET(Py_None), Py_INCREF_RET(Py_None));
|
||||
PyTuple_SET_ITEMS(ret, Py_NewRef(Py_None), Py_NewRef(Py_None));
|
||||
}
|
||||
else {
|
||||
const float dist_delta = ((rad_a * rad_a) - (rad_b * rad_b) + (dist * dist)) / (2.0f * dist);
|
||||
@@ -616,8 +616,8 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject * /*self*/, PyObject
|
||||
ret_no = Vector_CreatePyObject(isect_no, 3, nullptr);
|
||||
}
|
||||
else {
|
||||
ret_co = Py_INCREF_RET(Py_None);
|
||||
ret_no = Py_INCREF_RET(Py_None);
|
||||
ret_co = Py_NewRef(Py_None);
|
||||
ret_no = Py_NewRef(Py_None);
|
||||
}
|
||||
|
||||
ret = PyTuple_New(2);
|
||||
@@ -709,8 +709,8 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject * /*self*/, PyObject
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEMS(ret,
|
||||
use_a ? Vector_CreatePyObject(isect_a, 3, nullptr) : Py_INCREF_RET(Py_None),
|
||||
use_b ? Vector_CreatePyObject(isect_b, 3, nullptr) : Py_INCREF_RET(Py_None));
|
||||
use_a ? Vector_CreatePyObject(isect_a, 3, nullptr) : Py_NewRef(Py_None),
|
||||
use_b ? Vector_CreatePyObject(isect_b, 3, nullptr) : Py_NewRef(Py_None));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -800,8 +800,8 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject * /*self*/, PyObje
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEMS(ret,
|
||||
use_a ? Vector_CreatePyObject(isect_a, 2, nullptr) : Py_INCREF_RET(Py_None),
|
||||
use_b ? Vector_CreatePyObject(isect_b, 2, nullptr) : Py_INCREF_RET(Py_None));
|
||||
use_a ? Vector_CreatePyObject(isect_a, 2, nullptr) : Py_NewRef(Py_None),
|
||||
use_b ? Vector_CreatePyObject(isect_b, 2, nullptr) : Py_NewRef(Py_None));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user