Skip to content

Commit

Permalink
Fix compilation error under clang version 16
Browse files Browse the repository at this point in the history
When compiled using clang v16, it issued the following error:
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,
The higher version clang will check exact type match for function pointer.
  • Loading branch information
nining authored Apr 11, 2023
1 parent 5887dd6 commit 6badf63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lru.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ static PyMethodDef LRU_methods[] = {
PyDoc_STR("L.setdefault(key, default=None) -> If L has key return its value, otherwise insert key with a value of default and return default")},
{"pop", (PyCFunction)LRU_pop, METH_VARARGS,
PyDoc_STR("L.pop(key[, default]) -> If L has key return its value and remove it from L, otherwise return default. If default is not given and key is not in L, a KeyError is raised.")},
{"popitem", (PyCFunctionWithKeywords)LRU_popitem, METH_VARARGS | METH_KEYWORDS,
{"popitem", (PyCFunction)LRU_popitem, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("L.popitem([least_recent=True]) -> Returns and removes a (key, value) pair. The pair returned is the least-recently used if least_recent is true, or the most-recently used if false.")},
{"set_size", (PyCFunction)LRU_set_size, METH_VARARGS,
PyDoc_STR("L.set_size() -> set size of LRU")},
Expand Down

0 comments on commit 6badf63

Please sign in to comment.