@@ -401,28 +401,36 @@ cp Modules/readline.c Modules/readline-libedit.c
401401# using libedit.
402402patch -p1 << EOF
403403diff --git a/Modules/readline-libedit.c b/Modules/readline-libedit.c
404- index 57335fe911..f3e83ff932 100644
404+ index 1e74f997b0..56a36e26e6 100644
405405--- a/Modules/readline-libedit.c
406406+++ b/Modules/readline-libedit.c
407- @@ -486 ,7 +486 ,7 @@ set the word delimiters for completion");
408-
407+ @@ -511 ,7 +511 ,7 @@ set the word delimiters for completion");
408+
409409 /* _py_free_history_entry: Utility function to free a history entry. */
410-
410+
411411-#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0500
412412+#ifndef USE_LIBEDIT
413-
413+
414414 /* Readline version >= 5.0 introduced a timestamp field into the history entry
415415 structure; this needs to be freed to avoid a memory leak. This version of
416- @@ -1032 ,7 +1032 ,7 @@ flex_complete(const char *text, int start, int end)
416+ @@ -1055 ,7 +1055 ,7 @@ flex_complete(const char *text, int start, int end)
417417 #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
418418 rl_completion_append_character ='\0';
419419 #endif
420420-#ifdef HAVE_RL_COMPLETION_SUPPRESS_APPEND
421421+#ifndef USE_LIBEDIT
422422 rl_completion_suppress_append = 0;
423423 #endif
424-
425-
424+
425+ @@ -1241,7 +1241,7 @@ readline_until_enter_or_signal(const char *prompt, int *signal)
426+ PyEval_SaveThread();
427+ if (s < 0) {
428+ rl_free_line_state();
429+ -#if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0700
430+ +#ifndef USE_LIBEDIT
431+ rl_callback_sigcleanup();
432+ #endif
433+ rl_cleanup_after_signal();
426434EOF
427435
428436# Modules/readline.c has various libedit conditions behind an
0 commit comments