Mercurial > cpython-lru_cache-weakref
diff Modules/itertoolsmodule.c @ 45745:d5024ee9e88a legacy-trunk
Add 2-to-3 support for the itertools moved to builtins or renamed.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Thu, 13 Mar 2008 16:43:17 +0000 |
| parents | 0be9b1cf1b16 |
| children | d72d527de711 |
line wrap: on
line diff
--- a/Modules/itertoolsmodule.c Thu Mar 13 11:07:35 2008 +0000 +++ b/Modules/itertoolsmodule.c Thu Mar 13 16:43:17 2008 +0000 @@ -1445,6 +1445,11 @@ imapobject *lz; Py_ssize_t numargs, i; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "In 3.x, itertools.imap() was moved to builtin map()") < 0) + return NULL; + if (type == &imap_type && !_PyArg_NoKeywords("imap()", kwds)) return NULL; @@ -2536,6 +2541,11 @@ PyObject *it; ifilterobject *lz; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "In 3.x, itertools.ifilter() was moved to builtin filter().") < 0) + return NULL; + if (type == &ifilter_type && !_PyArg_NoKeywords("ifilter()", kwds)) return NULL; @@ -2679,6 +2689,11 @@ PyObject *it; ifilterfalseobject *lz; + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "In 3.x, ifilterfalse() was renamed to filterfalse().") < 0) + return NULL; + if (type == &ifilterfalse_type && !_PyArg_NoKeywords("ifilterfalse()", kwds)) return NULL; @@ -2985,6 +3000,11 @@ PyObject *result; Py_ssize_t tuplesize = PySequence_Length(args); + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "In 3.x, itertools.izip() was moved to builtin zip()") < 0) + return NULL; + if (type == &izip_type && !_PyArg_NoKeywords("izip()", kwds)) return NULL; @@ -3321,6 +3341,11 @@ PyObject *fillvalue = Py_None; Py_ssize_t tuplesize = PySequence_Length(args); + if (Py_Py3kWarningFlag && + PyErr_Warn(PyExc_DeprecationWarning, + "In 3.x, izip_longest() is renamed to zip_longest().") < 0) + return NULL; + if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) { fillvalue = PyDict_GetItemString(kwds, "fillvalue"); if (fillvalue == NULL || PyDict_Size(kwds) > 1) {
