diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-13 16:43:17 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-13 16:43:17 (GMT) |
commit | 10f40a6b5a2bdfbad9d013b42952b5abafa200e3 (patch) | |
tree | 35a39c859b479c78960ee926999657ebc4169f0b /Modules | |
parent | d51e842a3ff325730ff93a8c9ad22b1d3bdf77e2 (diff) | |
download | cpython-10f40a6b5a2bdfbad9d013b42952b5abafa200e3.zip cpython-10f40a6b5a2bdfbad9d013b42952b5abafa200e3.tar.gz cpython-10f40a6b5a2bdfbad9d013b42952b5abafa200e3.tar.bz2 |
Add 2-to-3 support for the itertools moved to builtins or renamed.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/itertoolsmodule.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 259b45a..8dd3a65 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -1445,6 +1445,11 @@ imap_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 @@ ifilter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 @@ ifilterfalse_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 @@ izip_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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 @@ izip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 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) { |