summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-02-10 21:31:27 (GMT)
committerGuido van Rossum <guido@python.org>2003-02-10 21:31:27 (GMT)
commit3f50cdc05e5254e1ce012ceca449387d50d28bc5 (patch)
treea877f2c5fec02c9b2e1db4261f0e6c64c3d53e0d /Objects
parent0c10015a6e374544b4664eb0165aef65d986f469 (diff)
downloadcpython-3f50cdc05e5254e1ce012ceca449387d50d28bc5.zip
cpython-3f50cdc05e5254e1ce012ceca449387d50d28bc5.tar.gz
cpython-3f50cdc05e5254e1ce012ceca449387d50d28bc5.tar.bz2
Get rid of the "bozo" __getstate__ that was inserted when __slots__
was used. This simplifies some logic in copy_reg.py (used by pickling). It also broke a test, but this was rewritten to test the new feature. :-)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 01eb706..31ac441 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1468,21 +1468,6 @@ static PyGetSetDef subtype_getsets_weakref_only[] = {
{0}
};
-/* bozo: __getstate__ that raises TypeError */
-
-static PyObject *
-bozo_func(PyObject *self, PyObject *args)
-{
- PyErr_SetString(PyExc_TypeError,
- "a class that defines __slots__ without "
- "defining __getstate__ cannot be pickled");
- return NULL;
-}
-
-static PyMethodDef bozo_ml = {"__getstate__", bozo_func, METH_VARARGS};
-
-static PyObject *bozo_obj = NULL;
-
static int
valid_identifier(PyObject *s)
{
@@ -1740,23 +1725,6 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
Py_DECREF(slots);
slots = newslots;
- /* See if *this* class defines __getstate__ */
- if (PyDict_GetItemString(dict, "__getstate__") == NULL) {
- /* If not, provide a bozo that raises TypeError */
- if (bozo_obj == NULL) {
- bozo_obj = PyCFunction_New(&bozo_ml, NULL);
- if (bozo_obj == NULL)
- goto bad_slots;
- }
- if (PyDict_SetItemString(dict,
- "__getstate__",
- bozo_obj) < 0)
- {
- Py_DECREF(bozo_obj);
- goto bad_slots;
- }
- }
-
/* Secondary bases may provide weakrefs or dict */
if (nbases > 1 &&
((may_add_dict && !add_dict) ||