]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
authorRaymond Hettinger <python@rcn.com>
Fri, 25 Jan 2008 19:24:46 +0000 (19:24 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 25 Jan 2008 19:24:46 +0000 (19:24 +0000)
it was released, but that reversion never made it to the Py2.6 head.

Lib/test/test_dict.py
Objects/dictobject.c
Objects/setobject.c

index b47e43ddb59d4ba6e9b3e126f20af0194fd53ba0..4ed76ea10b51be6db935e065bb1113fa64ac6bb9 100644 (file)
@@ -200,14 +200,6 @@ class DictTest(unittest.TestCase):
 
         self.assertRaises(ValueError, {}.update, [(1, 2, 3)])
 
-        # SF #1615701:  make d.update(m) honor __getitem__() and keys() in dict subclasses
-        class KeyUpperDict(dict):
-            def __getitem__(self, key):
-                return key.upper()
-        d.clear()
-        d.update(KeyUpperDict.fromkeys('abc'))
-        self.assertEqual(d, {'a':'A', 'b':'B', 'c':'C'})
-
     def test_fromkeys(self):
         self.assertEqual(dict.fromkeys('abc'), {'a':None, 'b':None, 'c':None})
         d = {}
index 1035e5fd5d6582002c9d05f27de7d60bb9b1b302..3b7c1287168ac5c523a31b12f66425fb54a4c194 100644 (file)
@@ -1406,7 +1406,7 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
                return -1;
        }
        mp = (PyDictObject*)a;
-       if (PyDict_CheckExact(b)) {
+       if (PyDict_Check(b)) {
                other = (PyDictObject*)b;
                if (other == mp || other->ma_used == 0)
                        /* a.update(a) or a.update({}); nothing to do */
index bb49b674fd30c2630ac57a064910fa0692657078..c8db7cef474acda0b04c8c80a09faf40ef6dd291 100644 (file)
@@ -912,7 +912,7 @@ set_update_internal(PySetObject *so, PyObject *other)
 {
        PyObject *key, *it;
 
-       if (PyAnySet_CheckExact(other))
+       if (PyAnySet_Check(other))
                return set_merge(so, other);
 
        if (PyDict_CheckExact(other)) {
@@ -1207,7 +1207,7 @@ set_intersection(PySetObject *so, PyObject *other)
        if (result == NULL)
                return NULL;
 
-       if (PyAnySet_CheckExact(other)) {               
+       if (PyAnySet_Check(other)) {            
                Py_ssize_t pos = 0;
                setentry *entry;
 
@@ -1398,7 +1398,7 @@ set_difference_update_internal(PySetObject *so, PyObject *other)
        if ((PyObject *)so == other)
                return set_clear_internal(so);
        
-       if (PyAnySet_CheckExact(other)) {
+       if (PyAnySet_Check(other)) {
                setentry *entry;
                Py_ssize_t pos = 0;
 
@@ -1447,7 +1447,7 @@ set_difference(PySetObject *so, PyObject *other)
        setentry *entry;
        Py_ssize_t pos = 0;
 
-       if (!PyAnySet_CheckExact(other)  && !PyDict_CheckExact(other)) {
+       if (!PyAnySet_Check(other)  && !PyDict_CheckExact(other)) {
                result = set_copy(so);
                if (result == NULL)
                        return NULL;
@@ -1554,7 +1554,7 @@ set_symmetric_difference_update(PySetObject *so, PyObject *other)
                Py_RETURN_NONE;
        }
 
-       if (PyAnySet_CheckExact(other)) {
+       if (PyAnySet_Check(other)) {
                Py_INCREF(other);
                otherset = (PySetObject *)other;
        } else {
@@ -1637,7 +1637,7 @@ set_issubset(PySetObject *so, PyObject *other)
        setentry *entry;
        Py_ssize_t pos = 0;
 
-       if (!PyAnySet_CheckExact(other)) {
+       if (!PyAnySet_Check(other)) {
                PyObject *tmp, *result;
                tmp = make_new_set(&PySet_Type, other);
                if (tmp == NULL)
@@ -1666,7 +1666,7 @@ set_issuperset(PySetObject *so, PyObject *other)
 {
        PyObject *tmp, *result;
 
-       if (!PyAnySet_CheckExact(other)) {
+       if (!PyAnySet_Check(other)) {
                tmp = make_new_set(&PySet_Type, other);
                if (tmp == NULL)
                        return NULL;