context['source_traceback'] = self._source_traceback
self._loop.call_exception_handler(context)
+ def __class_getitem__(cls, type):
+ return cls
+
@property
def _log_traceback(self):
return self.__log_traceback
def __str__(self):
return f'<{type(self).__name__} {self._format()}>'
+ def __class_getitem__(cls, type):
+ return cls
+
def _format(self):
result = f'maxsize={self._maxsize!r}'
if getattr(self, '_queue', None):
PyErr_Restore(error_type, error_value, error_traceback);
}
+static PyObject *
+future_cls_getitem(PyObject *cls, PyObject *type)
+{
+ Py_INCREF(cls);
+ return cls;
+}
static PyAsyncMethods FutureType_as_async = {
(unaryfunc)future_new_iter, /* am_await */
_ASYNCIO_FUTURE_DONE_METHODDEF
_ASYNCIO_FUTURE_GET_LOOP_METHODDEF
_ASYNCIO_FUTURE__REPR_INFO_METHODDEF
+ {"__class_getitem__", future_cls_getitem, METH_O|METH_CLASS, NULL},
{NULL, NULL} /* Sentinel */
};
FutureObj_finalize((FutureObj*)task);
}
+static PyObject *
+task_cls_getitem(PyObject *cls, PyObject *type)
+{
+ Py_INCREF(cls);
+ return cls;
+}
+
static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */
static PyMethodDef TaskType_methods[] = {
_ASYNCIO_TASK_GET_NAME_METHODDEF
_ASYNCIO_TASK_SET_NAME_METHODDEF
_ASYNCIO_TASK_GET_CORO_METHODDEF
+ {"__class_getitem__", task_cls_getitem, METH_O|METH_CLASS, NULL},
{NULL, NULL} /* Sentinel */
};