18.09.21 03:54, MRAB пише:
> static PyMethodDef customdict_methods[] = {
> ...
>     {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS |
> METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")},
> ...
> };
> 
> 
> Note the flags: METH_CLASS says that it's a class method and
> METH_COEXIST says that it should use this method instead of the slot.

"(PyCFunction)" is redundant, Py_GenericAlias already has the right
type. Overuse of casting to PyCFunction can hide actual bugs.

METH_COEXIST is not needed. There is no slot for __class_getitem__, and
even if it was, there would be no reasons to prohibit using it.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to