bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS by siddhesh · Pull Request #6030 · python/cpython (original) (raw)

Contributor Author

@siddhesh siddhesh left a comment • Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, I'm pushing a version with most of the fixes you suggested, except for removal of the cast. I've kept the casts in place because we will eventually need it. To fully fix the warnings, the ml_meth type should be like so:

PyObject *(*) (PyObject *, PyObject *, ...)

so that it matches with all of the allowed method types provided that there is an explicit cast in place. Right now I am not sure if I should change the PyCFunction type to that or to make a new PyCFunctionAny just for ml_meth. Since we're on this topic, what do you think is the preferred change? I suppose both change API, but not in a completely incompatible way.