Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1061cc

Browse files
committed
always point py3compat.input to builtin_mod.input
to preserve forwarding overrides made by the Kernel closes #4583
1 parent 04ab404 commit f1061cc

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

IPython/utils/py3compat.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def safe_unicode(e):
7474
if sys.version_info[0] >= 3:
7575
PY3 = True
7676

77-
input = input
77+
# keep reference to builtin_mod because the kernel overrides that value
78+
# to forward requests to a frontend.
79+
def input(prompt=''):
80+
return builtin_mod.input(prompt)
81+
7882
builtin_mod_name = "builtins"
7983
import builtins as builtin_mod
8084

@@ -131,7 +135,11 @@ def u_format(s):
131135
else:
132136
PY3 = False
133137

134-
input = raw_input
138+
# keep reference to builtin_mod because the kernel overrides that value
139+
# to forward requests to a frontend.
140+
def input(prompt=''):
141+
return builtin_mod.raw_input(prompt)
142+
135143
builtin_mod_name = "__builtin__"
136144
import __builtin__ as builtin_mod
137145

0 commit comments

Comments
 (0)