Skip to content

Commit e49ac09

Browse files
cmaloneyclaude
andcommitted
gh-87613: Check the attrib copy explicitly in get_attrib_from_keywords
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0f32147 commit e49ac09

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎Modules/_elementtree.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,10 @@ get_attrib_from_keywords(PyObject *kwds)
394394
return NULL;
395395
}
396396
Py_SETREF(attrib, _PyDict_CopyAsDict(attrib));
397-
if (attrib != NULL && PyDict_Update(attrib, kwds) < 0) {
397+
if (attrib == NULL) {
398+
return NULL;
399+
}
400+
if (PyDict_Update(attrib, kwds) < 0) {
398401
Py_DECREF(attrib);
399402
return NULL;
400403
}

0 commit comments

Comments
 (0)