diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-11 08:25:28 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-11 08:25:28 (GMT) |
commit | 9510e4a9f8503421c9f589e99e697aa5f3b89b69 (patch) | |
tree | 59e7f4f21d2c0902316f91b00d98e0e8d4b6c4aa /Objects/typeobject.c | |
parent | f602c71b077de965693c62d65d0e261bd964fbda (diff) | |
download | cpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.zip cpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.tar.gz cpython-9510e4a9f8503421c9f589e99e697aa5f3b89b69.tar.bz2 |
Added module stub for copy_reg renaming in 3.0.
Renamed copy_reg to copyreg in the standard library, to avoid
spurious warnings and ease later merging to py3k branch. Public
documentation remains intact.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 54ad714..4dfd39e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3058,31 +3058,31 @@ static PyGetSetDef object_getsets[] = { /* Stuff to implement __reduce_ex__ for pickle protocols >= 2. - We fall back to helpers in copy_reg for: + We fall back to helpers in copyreg for: - pickle protocols < 2 - calculating the list of slot names (done only once per class) - the __newobj__ function (which is used as a token but never called) */ static PyObject * -import_copy_reg(void) +import_copyreg(void) { - static PyObject *copy_reg_str; + static PyObject *copyreg_str; - if (!copy_reg_str) { - copy_reg_str = PyString_InternFromString("copy_reg"); - if (copy_reg_str == NULL) + if (!copyreg_str) { + copyreg_str = PyString_InternFromString("copyreg"); + if (copyreg_str == NULL) return NULL; } - return PyImport_Import(copy_reg_str); + return PyImport_Import(copyreg_str); } static PyObject * slotnames(PyObject *cls) { PyObject *clsdict; - PyObject *copy_reg; + PyObject *copyreg; PyObject *slotnames; if (!PyType_Check(cls)) { @@ -3097,12 +3097,12 @@ slotnames(PyObject *cls) return slotnames; } - copy_reg = import_copy_reg(); - if (copy_reg == NULL) + copyreg = import_copyreg(); + if (copyreg == NULL) return NULL; - slotnames = PyObject_CallMethod(copy_reg, "_slotnames", "O", cls); - Py_DECREF(copy_reg); + slotnames = PyObject_CallMethod(copyreg, "_slotnames", "O", cls); + Py_DECREF(copyreg); if (slotnames != NULL && slotnames != Py_None && !PyList_Check(slotnames)) @@ -3123,7 +3123,7 @@ reduce_2(PyObject *obj) PyObject *args = NULL, *args2 = NULL; PyObject *getstate = NULL, *state = NULL, *names = NULL; PyObject *slots = NULL, *listitems = NULL, *dictitems = NULL; - PyObject *copy_reg = NULL, *newobj = NULL, *res = NULL; + PyObject *copyreg = NULL, *newobj = NULL, *res = NULL; Py_ssize_t i, n; cls = PyObject_GetAttrString(obj, "__class__"); @@ -3218,10 +3218,10 @@ reduce_2(PyObject *obj) goto end; } - copy_reg = import_copy_reg(); - if (copy_reg == NULL) + copyreg = import_copyreg(); + if (copyreg == NULL) goto end; - newobj = PyObject_GetAttrString(copy_reg, "__newobj__"); + newobj = PyObject_GetAttrString(copyreg, "__newobj__"); if (newobj == NULL) goto end; @@ -3248,7 +3248,7 @@ reduce_2(PyObject *obj) Py_XDECREF(names); Py_XDECREF(listitems); Py_XDECREF(dictitems); - Py_XDECREF(copy_reg); + Py_XDECREF(copyreg); Py_XDECREF(newobj); return res; } @@ -3271,17 +3271,17 @@ reduce_2(PyObject *obj) static PyObject * _common_reduce(PyObject *self, int proto) { - PyObject *copy_reg, *res; + PyObject *copyreg, *res; if (proto >= 2) return reduce_2(self); - copy_reg = import_copy_reg(); - if (!copy_reg) + copyreg = import_copyreg(); + if (!copyreg) return NULL; - res = PyEval_CallMethod(copy_reg, "_reduce_ex", "(Oi)", self, proto); - Py_DECREF(copy_reg); + res = PyEval_CallMethod(copyreg, "_reduce_ex", "(Oi)", self, proto); + Py_DECREF(copyreg); return res; } |