summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 643f47b..ec0aa76 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1614,7 +1614,8 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_ssize_t numargs;
isliceobject *lz;
- if (type == &islice_type && !_PyArg_NoKeywords("islice", kwds))
+ if ((type == &islice_type || type->tp_init == islice_type.tp_init) &&
+ !_PyArg_NoKeywords("islice", kwds))
return NULL;
if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3))
@@ -2021,7 +2022,8 @@ chain_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *source;
- if (type == &chain_type && !_PyArg_NoKeywords("chain", kwds))
+ if ((type == &chain_type || type->tp_init == chain_type.tp_init) &&
+ !_PyArg_NoKeywords("chain", kwds))
return NULL;
source = PyObject_GetIter(args);