[Python-checkins] r60749 - in python/trunk: Modules/_collectionsmodule.c Objects/dictobject.c Objects/setobject.c
raymond.hettinger
python-checkins at python.org
Tue Feb 12 20:05:36 CET 2008
Author: raymond.hettinger
Date: Tue Feb 12 20:05:36 2008
New Revision: 60749
Modified:
python/trunk/Modules/_collectionsmodule.c
python/trunk/Objects/dictobject.c
python/trunk/Objects/setobject.c
Log:
dict.copy() rises from the ashes. Revert r60687.
Modified: python/trunk/Modules/_collectionsmodule.c
==============================================================================
--- python/trunk/Modules/_collectionsmodule.c (original)
+++ python/trunk/Modules/_collectionsmodule.c Tue Feb 12 20:05:36 2008
@@ -1186,23 +1186,13 @@
{
/* This calls the object's class. That only works for subclasses
whose class constructor has the same signature. Subclasses that
- define a different constructor signature must override __copy__().
+ define a different constructor signature must override copy().
*/
return PyObject_CallFunctionObjArgs((PyObject*)Py_TYPE(dd),
dd->default_factory, dd, NULL);
}
static PyObject *
-defdict_copy_method(defdictobject *dd)
-{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "defaultdict.copy() not supported in 3.x") < 0)
- return NULL;
- return defdict_copy(dd);
-}
-
-static PyObject *
defdict_reduce(defdictobject *dd)
{
/* __reduce__ must return a 5-tuple as follows:
@@ -1251,7 +1241,7 @@
static PyMethodDef defdict_methods[] = {
{"__missing__", (PyCFunction)defdict_missing, METH_O,
defdict_missing_doc},
- {"copy", (PyCFunction)defdict_copy_method, METH_NOARGS,
+ {"copy", (PyCFunction)defdict_copy, METH_NOARGS,
defdict_copy_doc},
{"__copy__", (PyCFunction)defdict_copy, METH_NOARGS,
defdict_copy_doc},
Modified: python/trunk/Objects/dictobject.c
==============================================================================
--- python/trunk/Objects/dictobject.c (original)
+++ python/trunk/Objects/dictobject.c Tue Feb 12 20:05:36 2008
@@ -1528,10 +1528,6 @@
static PyObject *
dict_copy(register PyDictObject *mp)
{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "dict.copy() not supported in 3.x") < 0)
- return NULL;
return PyDict_Copy((PyObject*)mp);
}
Modified: python/trunk/Objects/setobject.c
==============================================================================
--- python/trunk/Objects/setobject.c (original)
+++ python/trunk/Objects/setobject.c Tue Feb 12 20:05:36 2008
@@ -1131,22 +1131,8 @@
}
static PyObject *
-set_copy_method(PySetObject *so)
-{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "set.copy() not supported in 3.x") < 0)
- return NULL;
- return make_new_set(Py_TYPE(so), (PyObject *)so);
-}
-
-static PyObject *
frozenset_copy(PySetObject *so)
{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "frozenset.copy() not supported in 3.x") < 0)
- return NULL;
if (PyFrozenSet_CheckExact(so)) {
Py_INCREF(so);
return (PyObject *)so;
@@ -1925,7 +1911,7 @@
clear_doc},
{"__contains__",(PyCFunction)set_direct_contains, METH_O | METH_COEXIST,
contains_doc},
- {"copy", (PyCFunction)set_copy_method, METH_NOARGS,
+ {"copy", (PyCFunction)set_copy, METH_NOARGS,
copy_doc},
{"discard", (PyCFunction)set_discard, METH_O,
discard_doc},
More information about the Python-checkins
mailing list