From 15a0296c0d34aae4a747ad8052beb21c2ab4d128 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 30 Jun 2023 23:36:17 +0900 Subject: [PATCH 1/2] gh-105323: Suppress function pointer warning by type casting --- Modules/readline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/readline.c b/Modules/readline.c index ff7075c6822e27..152951a13448d9 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1249,9 +1249,9 @@ setup_readline(readlinestate *mod_state) sigwinch_ohandler = PyOS_setsig(SIGWINCH, readline_sigwinch_handler); #endif /* Set our hook functions */ - rl_startup_hook = on_startup_hook; + rl_startup_hook = (Function *)on_startup_hook; #ifdef HAVE_RL_PRE_INPUT_HOOK - rl_pre_input_hook = on_pre_input_hook; + rl_pre_input_hook = (Function *)on_pre_input_hook; #endif /* Set our completion function */ rl_attempted_completion_function = flex_complete; From b802b37f7cfb741ff9c18a3492306835d128396c Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 1 Jul 2023 00:30:23 +0900 Subject: [PATCH 2/2] Update function signature --- Modules/readline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/readline.c b/Modules/readline.c index 152951a13448d9..671a8b40aaf2eb 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1013,9 +1013,9 @@ on_hook(PyObject *func) static int #if defined(_RL_FUNCTION_TYPEDEF) -on_startup_hook(void) +on_startup_hook(const char *, int) #else -on_startup_hook(void) +on_startup_hook(const char *, int) #endif { int r; @@ -1028,9 +1028,9 @@ on_startup_hook(void) #ifdef HAVE_RL_PRE_INPUT_HOOK static int #if defined(_RL_FUNCTION_TYPEDEF) -on_pre_input_hook(void) +on_pre_input_hook(const char *, int) #else -on_pre_input_hook(void) +on_pre_input_hook(const char *, int) #endif { int r; @@ -1249,9 +1249,9 @@ setup_readline(readlinestate *mod_state) sigwinch_ohandler = PyOS_setsig(SIGWINCH, readline_sigwinch_handler); #endif /* Set our hook functions */ - rl_startup_hook = (Function *)on_startup_hook; + rl_startup_hook = on_startup_hook; #ifdef HAVE_RL_PRE_INPUT_HOOK - rl_pre_input_hook = (Function *)on_pre_input_hook; + rl_pre_input_hook = on_pre_input_hook; #endif /* Set our completion function */ rl_attempted_completion_function = flex_complete;