Merge branch 'blender-v2.93-release'

This commit is contained in:
Campbell Barton 2021-05-14 19:27:30 +10:00
commit bd5bab961e
4 changed files with 13 additions and 7 deletions

View File

@ -766,7 +766,7 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
}
/* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
case IDP_STRING:
@ -919,7 +919,7 @@ static PyObject *BPy_IDGroup_pop(BPy_IDProperty *self, PyObject *args)
return NULL;
}
IDP_RemoveFromGroup(self->prop, idprop);
IDP_FreeFromGroup(self->prop, idprop);
return pyform;
}

View File

@ -60,6 +60,7 @@ PyObject *BPy_Wrap_GetValues(struct ID *id, struct IDProperty *prop);
PyObject *BPy_Wrap_GetItems(struct ID *id, struct IDProperty *prop);
int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val);
PyObject *BPy_IDGroup_MapDataToPy(struct IDProperty *prop);
PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop, struct IDProperty *parent);
bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob);

View File

@ -5006,8 +5006,13 @@ static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
idprop = IDP_GetPropertyFromGroup(group, key);
if (idprop) {
PyObject *ret = BPy_IDGroup_WrapData(self->ptr.owner_id, idprop, group);
IDP_RemoveFromGroup(group, idprop);
/* Don't use #BPy_IDGroup_WrapData as the id-property is being removed from the ID. */
PyObject *ret = BPy_IDGroup_MapDataToPy(idprop);
/* Internal error. */
if (UNLIKELY(ret == NULL)) {
return NULL;
}
IDP_FreeFromGroup(group, idprop);
return ret;
}
}

View File

@ -15,12 +15,12 @@ class TestHelper:
def setUp(self):
self._id = bpy.context.scene
assert(len(self._id.keys()) == 0 or self._id.keys() == ["cycles"])
self._id.pop("cycles", None)
assert(len(self._id.keys()) == 0)
def tearDown(self):
for key in list(self._id.keys()):
if key != "cycles":
del self._id[key]
del self._id[key]
def assertAlmostEqualSeq(self, list1, list2):
self.assertEqual(len(list1), len(list2))