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

Skip to content

Commit 6375257

Browse files
committed
Back out fix for issue #13886; it introduced a new bug in interactive readline use.
1 parent e5e6444 commit 6375257

3 files changed

Lines changed: 1 addition & 12 deletions

File tree

Lib/test/test_builtin.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
import pty, signal
1919
except ImportError:
2020
pty = signal = None
21-
# Importing this module has the side-effect of changing the behavior of input().
22-
# Ensure that we always use the readline version (if available), so we don't get
23-
# different results depending on what other tests have already imported.
24-
try:
25-
import readline
26-
except ImportError:
27-
pass
2821

2922

3023
class Squares:

Misc/NEWS

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ Core and Builtins
1212

1313
- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
1414

15-
- Issue #13886: Fix input() to not strip out input bytes that cannot be decoded
16-
using the locale encoding. Also fix sporadic failures in test_builtin due to
17-
dependence on whether the readline module has previously been imported.
18-
1915
- Issue #10156: In the interpreter's initialization phase, unicode globals
2016
are now initialized dynamically as needed.
2117

Modules/readline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
10681068
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
10691069
if (!saved_locale)
10701070
Py_FatalError("not enough memory to save locale");
1071-
setlocale(LC_CTYPE, "C");
1071+
setlocale(LC_CTYPE, "");
10721072
#endif
10731073

10741074
if (sys_stdin != rl_instream || sys_stdout != rl_outstream) {

0 commit comments

Comments
 (0)