Skip to content

Commit 57064dc

Browse files
committed
refactor redundant comment
1 parent 002b3a6 commit 57064dc

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Modules/_collectionsmodule.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,12 +2231,9 @@ defdict_missing(PyObject *op, PyObject *key)
22312231
value = _PyObject_CallNoArgs(factory);
22322232
if (value == NULL)
22332233
return value;
2234-
PyObject* result;
2235-
PyDict_SetDefaultRef(op, key, value, &result);
2236-
// when PyDict_SetDefaultRef() < 0, result will be NULL
2237-
// when PyDict_SetDefaultRef() == 0, result is a new reference of default value
2238-
// when PyDict_SetDefaultRef() > 0, result is a new reference to the existing value
2239-
// so the value reference must be decref'ed in all cases
2234+
PyObject *result = NULL;
2235+
(void)PyDict_SetDefaultRef(op, key, value, &result);
2236+
// 'result' is NULL, or a strong reference to 'value' or 'op[key]'
22402237
Py_DECREF(value);
22412238
return result;
22422239
}

0 commit comments

Comments
 (0)