Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kraj
Copy link
Contributor

@kraj kraj commented Mar 2, 2023

PyMethodDef uses PyMethodDef and not PyCFunctionWithKeywords and when callback is specified as PyCFunctionWithKeywords, clang 16+ is able to detect function signature mismatch in function pointers now.

Fixes
lru.c:629:17: error: incompatible function pointer types initializing 'PyCFunction' (aka 'struct _object ()(struct _object *, struct _object *)') with an expression of type 'PyCFunctionWithKeywords' (aka 'struct _object ()(struct _object *, struct _object *, struct _object *)') [-Wincompatible-function-pointer-types]
{"popitem", (PyCFunctionWithKeywords)LRU_popitem, METH_VARARGS | METH_KEYWORDS,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

PyMethodDef uses PyMethodDef and not PyCFunctionWithKeywords and when
callback is specified as PyCFunctionWithKeywords, clang 16+ is able to
detect function signature mismatch in function pointers now.

Fixes
lru.c:629:17: error: incompatible function pointer types initializing 'PyCFunction' (aka 'struct _object *(*)(struct _object *, struct _object *)') with an expression of type 'PyCFunctionWithKeywords' (aka 'struct _object *(*)(struct _object *, struct _object *, struct _object *)') [-Wincompatible-function-pointer-types]
    {"popitem", (PyCFunctionWithKeywords)LRU_popitem, METH_VARARGS | METH_KEYWORDS,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Khem Raj <[email protected]>
@amitdev
Copy link
Owner

amitdev commented May 26, 2023

Sorry for the delay in looking into this. Thanks for the PR!

@amitdev amitdev merged commit 7942c33 into amitdev:master May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants