Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.5 Changeset: r92543:e3aa955289ca Date: 2017-10-02 00:31 +0200 http://bitbucket.org/pypy/pypy/changeset/e3aa955289ca/
Log: On Windows, use GetConsoleCP for stdin. diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -2217,12 +2217,15 @@ if not (rposix.is_valid_fd(fd) and os.isatty(fd)): return space.w_None if _WIN32: - ccp = rwin32.GetConsoleOutputCP() - if ccp == 0: - return space.w_None if fd == 0: - return space.newtext('cp%d' % ccp) - if fd in (1, 2): + ccp = rwin32.GetConsoleCP() + elif fd in (1, 2): + ccp = rwin32.GetConsoleOutputCP() + else: + ccp = 0 + # GetConsoleCP() and GetConsoleOutputCP() return 0 if the + # application has no console. + if ccp != 0: return space.newtext('cp%d' % ccp) from rpython.rlib import rlocale if rlocale.HAVE_LANGINFO: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit