Siddhesh Poyarekar <siddhesh.poyare...@gmail.com> added the comment:

> I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* 
> are fine - any function pointer can be cast to any other function pointer - 
> it is only that they must *not* be called unless cast back again to be 
> compatible with the function definition. Any fix to the contrary might well 
> *cause* undefined behaviour!

Please see the attached PR; METH_NOARGS callbacks are inconsistent in their 
signature and many have just one argument while they're called with two 
arguments, the second being NULL.  The patch fixes these to consistently take 
and call with two arguments.

> Could you provide a sample of the *actual warnings* so that they could be 
> studied?

Here's one of a few hundred.

Objects/bytesobject.c:3085:25: warning: cast between incompatible function 
types from ‘PyObject * (*)(striterobject *)’ {aka ‘struct _object * (*)(struct 
<anonymous> *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct 
_object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
     {"__reduce__",      (PyCFunction)striter_reduce, METH_NOARGS,
                         ^
This is a new warning in gcc8, so you'll likely not find much reference, but 
here's a gcc bug report that might give you more context:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84531

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33012>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to