[Python-checkins] r60291 - in python/trunk: Lib/test/test_dict.py Objects/dictobject.c Objects/setobject.c
raymond.hettinger
python-checkins at python.org
Fri Jan 25 20:24:47 CET 2008
Author: raymond.hettinger
Date: Fri Jan 25 20:24:46 2008
New Revision: 60291
Modified:
python/trunk/Lib/test/test_dict.py
python/trunk/Objects/dictobject.c
python/trunk/Objects/setobject.c
Log:
Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
it was released, but that reversion never made it to the Py2.6 head.
Modified: python/trunk/Lib/test/test_dict.py
==============================================================================
--- python/trunk/Lib/test/test_dict.py (original)
+++ python/trunk/Lib/test/test_dict.py Fri Jan 25 20:24:46 2008
@@ -200,14 +200,6 @@
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 = {}
Modified: python/trunk/Objects/dictobject.c
==============================================================================
--- python/trunk/Objects/dictobject.c (original)
+++ python/trunk/Objects/dictobject.c Fri Jan 25 20:24:46 2008
@@ -1406,7 +1406,7 @@
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 */
Modified: python/trunk/Objects/setobject.c
==============================================================================
--- python/trunk/Objects/setobject.c (original)
+++ python/trunk/Objects/setobject.c Fri Jan 25 20:24:46 2008
@@ -912,7 +912,7 @@
{
PyObject *key, *it;
- if (PyAnySet_CheckExact(other))
+ if (PyAnySet_Check(other))
return set_merge(so, other);
if (PyDict_CheckExact(other)) {
@@ -1207,7 +1207,7 @@
if (result == NULL)
return NULL;
- if (PyAnySet_CheckExact(other)) {
+ if (PyAnySet_Check(other)) {
Py_ssize_t pos = 0;
setentry *entry;
@@ -1398,7 +1398,7 @@
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 @@
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 @@
Py_RETURN_NONE;
}
- if (PyAnySet_CheckExact(other)) {
+ if (PyAnySet_Check(other)) {
Py_INCREF(other);
otherset = (PySetObject *)other;
} else {
@@ -1637,7 +1637,7 @@
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 @@
{
PyObject *tmp, *result;
- if (!PyAnySet_CheckExact(other)) {
+ if (!PyAnySet_Check(other)) {
tmp = make_new_set(&PySet_Type, other);
if (tmp == NULL)
return NULL;
More information about the Python-checkins
mailing list