@@ -1637,18 +1637,23 @@ FutureIter_send(futureiterobject *self, PyObject *unused)
1637
1637
}
1638
1638
1639
1639
static PyObject *
1640
- FutureIter_throw (futureiterobject * self , PyObject * args )
1640
+ FutureIter_throw (futureiterobject * self , PyObject * const * args , Py_ssize_t nargs )
1641
1641
{
1642
1642
PyObject * type , * val = NULL , * tb = NULL ;
1643
- if (!PyArg_ParseTuple ( args , "O|OO " , & type , & val , & tb ))
1643
+ if (!_PyArg_CheckPositional ( "throw " , nargs , 1 , 3 )) {
1644
1644
return NULL ;
1645
+ }
1645
1646
1646
- if (val == Py_None ) {
1647
- val = NULL ;
1647
+ type = args [0 ];
1648
+ if (nargs == 3 ) {
1649
+ val = args [1 ];
1650
+ tb = args [2 ];
1651
+ }
1652
+ else if (nargs == 2 ) {
1653
+ val = args [1 ];
1648
1654
}
1649
- if (tb == Py_None ) {
1650
- tb = NULL ;
1651
- } else if (tb != NULL && !PyTraceBack_Check (tb )) {
1655
+
1656
+ if (tb != NULL && !PyTraceBack_Check (tb )) {
1652
1657
PyErr_SetString (PyExc_TypeError , "throw() third argument must be a traceback" );
1653
1658
return NULL ;
1654
1659
}
@@ -1708,7 +1713,7 @@ FutureIter_traverse(futureiterobject *it, visitproc visit, void *arg)
1708
1713
1709
1714
static PyMethodDef FutureIter_methods [] = {
1710
1715
{"send" , (PyCFunction )FutureIter_send , METH_O , NULL },
1711
- {"throw" , (PyCFunction )FutureIter_throw , METH_VARARGS , NULL },
1716
+ {"throw" , (PyCFunction )FutureIter_throw , METH_FASTCALL , NULL },
1712
1717
{"close" , (PyCFunction )FutureIter_close , METH_NOARGS , NULL },
1713
1718
{NULL , NULL } /* Sentinel */
1714
1719
};
0 commit comments