aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index d1154eb344f..868623a9f7b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1577,6 +1577,14 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name,
goto error_check;
}
dictptr = &dorv_ptr->dict;
+ if (*dictptr == NULL) {
+ if (_PyObject_InitInlineValues(obj, tp) < 0) {
+ goto done;
+ }
+ res = _PyObject_StoreInstanceAttribute(
+ obj, _PyDictOrValues_GetValues(*dorv_ptr), name, value);
+ goto error_check;
+ }
}
else {
dictptr = _PyObject_ComputedDictPointer(obj);