Skip to content

Commit

Permalink
Add check to make sure title dictionary insert is not over-writing so…
Browse files Browse the repository at this point in the history
…mething already there.
  • Loading branch information
teoliphant committed Feb 11, 2006
1 parent 7d4d958 commit 9175b19
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion numpy/core/src/multiarraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3729,7 +3729,16 @@ _convert_from_dict(PyObject *obj, int align)
}
PyDict_SetItem(fields, name, tup);
Py_DECREF(name);
if (len == 3) PyDict_SetItem(fields, item, tup);
if (len == 3) {
if (PyDict_GetItem(fields, item) != NULL) {
PyErr_SetString(PyExc_ValueError,
"titles cannot be the same as names");
ret=PY_FAIL;
}
else {
PyDict_SetItem(fields, item, tup);
}
}
Py_DECREF(tup);
if ((ret == PY_FAIL) || (newdescr->elsize == 0)) goto fail;
if (!hasobject && newdescr->hasobject)
Expand Down

0 comments on commit 9175b19

Please sign in to comment.