summaryrefslogtreecommitdiff
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-05-17 00:27:33 -0700
committerNed Deily <nad@python.org>2018-05-17 03:27:33 -0400
commitd504108a88bd14a560dec875df682f4e581490e5 (patch)
tree61ac0557b8d45ebb01f5d30548dc69f4c9e8219a /Modules/readline.c
parent9c17cd3214987c35a60dd4076fc3530f2b79bf52 (diff)
downloadcpython-git-d504108a88bd14a560dec875df682f4e581490e5.tar.gz
bpo-13631: Fix the order of initialization for readline libedit on macOS. (GH-6915) (GH-6928)
The editline emulation needs to be initialized *after* the name is defined. This fixes the long open issue. (cherry picked from commit c2f082e9d164acfa8f96de9526f0f47ae92c426a) Co-authored-by: Zvezdan Petkovic <zpetkovic@acm.org>
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 811fca8cd9..7756e6b2bc 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1078,6 +1078,9 @@ setup_readline(readlinestate *mod_state)
Py_FatalError("not enough memory to save locale");
#endif
+ /* The name must be defined before initialization */
+ rl_readline_name = "python";
+
#ifdef __APPLE__
/* the libedit readline emulation resets key bindings etc
* when calling rl_initialize. So call it upfront
@@ -1099,7 +1102,6 @@ setup_readline(readlinestate *mod_state)
using_history();
- rl_readline_name = "python";
/* Force rebind of TAB to insert-tab */
rl_bind_key('\t', rl_insert);
/* Bind both ESC-TAB and ESC-ESC to the completion function */