[Python-checkins] r53618 - python/trunk/Objects/setobject.c

raymond.hettinger python-checkins at python.org
Thu Feb 1 22:03:00 CET 2007


Author: raymond.hettinger
Date: Thu Feb  1 22:02:59 2007
New Revision: 53618

Modified:
   python/trunk/Objects/setobject.c
Log:
Bug #1648179:  set.update() not recognizing __iter__ overrides in dict subclasses.

Modified: python/trunk/Objects/setobject.c
==============================================================================
--- python/trunk/Objects/setobject.c	(original)
+++ python/trunk/Objects/setobject.c	Thu Feb  1 22:02:59 2007
@@ -915,7 +915,7 @@
 	if (PyAnySet_Check(other))
 		return set_merge(so, other);
 
-	if (PyDict_Check(other)) {
+	if (PyDict_CheckExact(other)) {
 		PyObject *value;
 		Py_ssize_t pos = 0;
 		while (PyDict_Next(other, &pos, &key, &value)) {
@@ -1363,7 +1363,7 @@
 	setentry *entry;
 	Py_ssize_t pos = 0;
 
-	if (!PyAnySet_Check(other)  && !PyDict_Check(other)) {
+	if (!PyAnySet_Check(other)  && !PyDict_CheckExact(other)) {
 		result = set_copy(so);
 		if (result == NULL)
 			return NULL;
@@ -1377,7 +1377,7 @@
 	if (result == NULL)
 		return NULL;
 
-	if (PyDict_Check(other)) {
+	if (PyDict_CheckExact(other)) {
 		while (set_next(so, &pos, &entry)) {
 			setentry entrycopy;
 			entrycopy.hash = entry->hash;
@@ -1450,7 +1450,7 @@
 	if ((PyObject *)so == other)
 		return set_clear(so);
 
-	if (PyDict_Check(other)) {
+	if (PyDict_CheckExact(other)) {
 		PyObject *value;
 		int rv;
 		while (PyDict_Next(other, &pos, &key, &value)) {


More information about the Python-checkins mailing list