summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-08 19:01:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-08 19:01:18 (GMT)
commitdf53392f0d7977e0439fb43684af5a805d5e4a45 (patch)
treeb7abbdca481a81b9fd02b7329c3d30c1558942ba /Objects/rangeobject.c
parentaa078674e01090b000f7af89734a4d8b64a4422d (diff)
downloadcpython-df53392f0d7977e0439fb43684af5a805d5e4a45.zip
cpython-df53392f0d7977e0439fb43684af5a805d5e4a45.tar.gz
cpython-df53392f0d7977e0439fb43684af5a805d5e4a45.tar.bz2
Issue #28376: Creating instances of range_iterator by calling range_iterator
type now is disallowed. Calling iter() on range instance is the only way. Patch by Oren Milman.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 8449fc7..45c557f 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -829,8 +829,6 @@ static PyMethodDef rangeiter_methods[] = {
{NULL, NULL} /* sentinel */
};
-static PyObject *rangeiter_new(PyTypeObject *, PyObject *args, PyObject *kw);
-
PyTypeObject PyRangeIter_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"range_iterator", /* tp_name */
@@ -862,15 +860,6 @@ PyTypeObject PyRangeIter_Type = {
(iternextfunc)rangeiter_next, /* tp_iternext */
rangeiter_methods, /* tp_methods */
0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- rangeiter_new, /* tp_new */
};
/* Return number of items in range (lo, hi, step). step != 0
@@ -925,36 +914,6 @@ fast_range_iter(long start, long stop, long step)
return (PyObject *)it;
}
-static PyObject *
-rangeiter_new(PyTypeObject *type, PyObject *args, PyObject *kw)
-{
- long start, stop, step;
-
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "range_iterator(): creating instances of range_iterator "
- "by calling range_iterator type is deprecated",
- 1)) {
- return NULL;
- }
-
- if (!_PyArg_NoKeywords("range_iterator()", kw)) {
- return NULL;
- }
-
- if (!PyArg_ParseTuple(args,
- "lll;range_iterator() requires 3 int arguments",
- &start, &stop, &step)) {
- return NULL;
- }
- if (step == 0) {
- PyErr_SetString(PyExc_ValueError,
- "range_iterator() arg 3 must not be zero");
- return NULL;
- }
-
- return fast_range_iter(start, stop, step);
-}
-
typedef struct {
PyObject_HEAD
PyObject *index;