diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 092c9061bb7..01d0a1f0c19 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2822,18 +2822,22 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX; /* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */ - if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) + if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) { return NULL; - if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) + } + if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) { return NULL; + } if (start < 0 || stop < 0) { /* only get the length for negative values */ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); - if (start < 0) + if (start < 0) { start += len; - if (stop < 0) + } + if (stop < 0) { stop += len; + } } if (stop - start <= 0) { @@ -4301,8 +4305,9 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname) { PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)self)); - if (dict == NULL) /* unlikely */ + if (UNLIKELY(dict == NULL)) { return 0; + } return PyDict_Contains(dict, pyname); } @@ -4331,7 +4336,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr * Disable for now, * this is faking internal behavior in a way that's too tricky to maintain well. */ # if 0 - if (ret == NULL) { // || pyrna_is_deferred_prop(ret) + if ((ret == NULL) /* || pyrna_is_deferred_prop(ret) */ ) { StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__"); if (srna) { PropertyRNA *prop = RNA_struct_type_find_property(srna, _PyUnicode_AsString(attr)); |