Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect C function signature casts #2363

Closed
scoder opened this issue Jun 17, 2018 · 1 comment
Closed

Incorrect C function signature casts #2363

scoder opened this issue Jun 17, 2018 · 1 comment

Comments

@scoder
Copy link
Contributor

scoder commented Jun 17, 2018

A new warning in gcc-8 detects several incorrect PyCFunction pointer casts in the Cython generated code.

Examples in the test suite:

special_methods_T561.c:23416:16: warning: cast between incompatible function types from ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
   {"__next__", (PyCFunction)__pyx_pw_20special_methods_T561_11VerySpecial_99__next__, METH_NOARGS|METH_COEXIST, 0},

unused.c:1732:132: warning: cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6unused_6Unused_1cp_unused_simple)) {

genexpr_T715.c:4460:15: warning: cast between incompatible function types from ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
     {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS,
@scoder scoder added this to the 0.29 milestone Jun 17, 2018
scoder added a commit that referenced this issue Jun 17, 2018
…t their signature for the PyCFunction entry in PyMethodDef.

Previously, their cast to a two-argument PyCFunction was incorrect.
See #2363.
@scoder
Copy link
Contributor Author

scoder commented Jun 17, 2018

Fixes: 09ac77a, 4417844, 60ceabc, 77ca931, 395cc67

scoder added a commit that referenced this issue Jun 17, 2018
… signature for the PyCFunction entry in PyMethodDef.

See #2363.
@scoder scoder closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant