Skip to content

Commit aaf7bf0

Browse files
committed
pythongh-105223: Add special workround for macOS default editline
1 parent 30305d6 commit aaf7bf0

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

Modules/readline.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,10 +1019,16 @@ on_hook(PyObject *func)
10191019
static int
10201020
#if defined(_RL_FUNCTION_TYPEDEF)
10211021
on_startup_hook(void)
1022+
{
1023+
#elif defined(__APPLE__) && defined(WITH_EDITLINE)
1024+
on_startup_hook(const char *text, int state)
1025+
{
1026+
(void)text;
1027+
(void)state;
10221028
#else
10231029
on_startup_hook(void)
1024-
#endif
10251030
{
1031+
#endif
10261032
int r;
10271033
PyGILState_STATE gilstate = PyGILState_Ensure();
10281034
r = on_hook(readlinestate_global->startup_hook);
@@ -1034,10 +1040,16 @@ on_startup_hook(void)
10341040
static int
10351041
#if defined(_RL_FUNCTION_TYPEDEF)
10361042
on_pre_input_hook(void)
1043+
{
1044+
#elif defined(__APPLE__) && defined(WITH_EDITLINE)
1045+
on_pre_input_hook(const char *text, int state)
1046+
{
1047+
(void)text;
1048+
(void)state;
10371049
#else
10381050
on_pre_input_hook(void)
1039-
#endif
10401051
{
1052+
#endif
10411053
int r;
10421054
PyGILState_STATE gilstate = PyGILState_Ensure();
10431055
r = on_hook(readlinestate_global->pre_input_hook);

configure

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5822,13 +5822,24 @@ AC_ARG_WITH(
58225822
AS_CASE([$with_readline],
58235823
[editline|edit], [with_readline=edit],
58245824
[yes|readline], [with_readline=readline],
5825-
[no], [],
5825+
[no], [with_readline=default],
58265826
[AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline|readline|no@:>@])]
58275827
)
58285828
],
5829-
[with_readline=readline]
5829+
[with_readline=default]
58305830
)
58315831

5832+
AS_VAR_IF([with_readline], [default], [
5833+
case $ac_sys_system/$ac_sys_release in
5834+
Darwin/*) AC_DEFINE([WITH_EDITLINE], [1])
5835+
with_readline=readline
5836+
;;
5837+
*)
5838+
with_readline=readline
5839+
;;
5840+
esac
5841+
])
5842+
58325843
AS_VAR_IF([with_readline], [readline], [
58335844
PKG_CHECK_MODULES([LIBREADLINE], [readline], [
58345845
LIBREADLINE=readline

0 commit comments

Comments
 (0)