summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-12-07 08:10:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-12-07 08:10:51 (GMT)
commite03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc (patch)
treedb14be0a74de88bd73272d1fc3ab09a34746ae52 /Objects/dictobject.c
parent4e52ca82aec12f911196ca7c452102d10dda5422 (diff)
downloadcpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.zip
cpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.tar.gz
cpython-e03e5b1f91452603a4cbd6df99c7c7d4a6bcc2cc.tar.bz2
Remove assumption that cls is a subclass of dict.
Simplifies the code and gets Just van Rossum's example to work.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index d3603f0..69adc50 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -979,12 +979,6 @@ dict_fromkeys(PyObject *mp, PyObject *args)
d = PyObject_CallObject(cls, NULL);
if (d == NULL)
return NULL;
- if (!PyDict_Check(d)) {
- Py_DECREF(d);
- PyErr_SetString(PyExc_TypeError,
- "class constructor must return a subclass of dict");
- return NULL;
- }
it = PyObject_GetIter(seq);
if (it == NULL){
@@ -999,7 +993,7 @@ dict_fromkeys(PyObject *mp, PyObject *args)
goto Fail;
break;
}
- status = PyDict_SetItem(d, key, value);
+ status = PyObject_SetItem(d, key, value);
Py_DECREF(key);
if (status < 0)
goto Fail;