summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorJoshua Root <jmr@macports.org>2024-04-17 09:26:10 (GMT)
committerGitHub <noreply@github.com>2024-04-17 09:26:10 (GMT)
commit8515fd79fef1ac16d7848cec5ec1797294cb5366 (patch)
tree28cc3745dea1506bd2bb463bf21777ef46c67640 /Modules/readline.c
parentf74e51229c83e3265f905dc15283bfe0ec1a659e (diff)
downloadcpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.zip
cpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.tar.gz
cpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.tar.bz2
gh-117845: Detect libedit hook function signature in configure (#117870)
Older libedit versions (like Apple's) use a different type signature for rl_startup_hook and rl_pre_input_hook. Add a configure check to determine which signature is accepted by introducing the Py_RL_STARTUP_HOOK_TAKES_ARGS macro in pyconfig.h.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index e29051c..c5c3453 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1041,7 +1041,7 @@ on_hook(PyObject *func)
}
static int
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(_RL_FUNCTION_TYPEDEF) || !defined(Py_RL_STARTUP_HOOK_TAKES_ARGS)
on_startup_hook(void)
#else
on_startup_hook(const char *Py_UNUSED(text), int Py_UNUSED(state))
@@ -1061,7 +1061,7 @@ on_startup_hook(const char *Py_UNUSED(text), int Py_UNUSED(state))
#ifdef HAVE_RL_PRE_INPUT_HOOK
static int
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(_RL_FUNCTION_TYPEDEF) || !defined(Py_RL_STARTUP_HOOK_TAKES_ARGS)
on_pre_input_hook(void)
#else
on_pre_input_hook(const char *Py_UNUSED(text), int Py_UNUSED(state))