Bug #1648179: set.update() not recognizing __iter__ overrides in dict subclasses.

This commit is contained in:
Raymond Hettinger 2007-02-01 21:02:59 +00:00
parent 129bd52146
commit db67aef672
1 changed files with 4 additions and 4 deletions

View File

@ -915,7 +915,7 @@ set_update_internal(PySetObject *so, PyObject *other)
if (PyAnySet_Check(other)) if (PyAnySet_Check(other))
return set_merge(so, other); return set_merge(so, other);
if (PyDict_Check(other)) { if (PyDict_CheckExact(other)) {
PyObject *value; PyObject *value;
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
while (PyDict_Next(other, &pos, &key, &value)) { while (PyDict_Next(other, &pos, &key, &value)) {
@ -1363,7 +1363,7 @@ set_difference(PySetObject *so, PyObject *other)
setentry *entry; setentry *entry;
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
if (!PyAnySet_Check(other) && !PyDict_Check(other)) { if (!PyAnySet_Check(other) && !PyDict_CheckExact(other)) {
result = set_copy(so); result = set_copy(so);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
@ -1377,7 +1377,7 @@ set_difference(PySetObject *so, PyObject *other)
if (result == NULL) if (result == NULL)
return NULL; return NULL;
if (PyDict_Check(other)) { if (PyDict_CheckExact(other)) {
while (set_next(so, &pos, &entry)) { while (set_next(so, &pos, &entry)) {
setentry entrycopy; setentry entrycopy;
entrycopy.hash = entry->hash; entrycopy.hash = entry->hash;
@ -1450,7 +1450,7 @@ set_symmetric_difference_update(PySetObject *so, PyObject *other)
if ((PyObject *)so == other) if ((PyObject *)so == other)
return set_clear(so); return set_clear(so);
if (PyDict_Check(other)) { if (PyDict_CheckExact(other)) {
PyObject *value; PyObject *value;
int rv; int rv;
while (PyDict_Next(other, &pos, &key, &value)) { while (PyDict_Next(other, &pos, &key, &value)) {