[pypy-commit] pypy py3.5: win32 can run without a console, return None in this case (amaury advising)
mattip
pypy.commits at gmail.com
Sun Oct 1 17:06:47 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.5
Changeset: r92540:73f012309b3c
Date: 2017-10-02 00:01 +0300
http://bitbucket.org/pypy/pypy/changeset/73f012309b3c/
Log: win32 can run without a console, return None in this case (amaury
advising)
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,10 +2217,13 @@
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' % rwin32.GetConsoleCP())
+ return space.newtext('cp%d' % ccp)
if fd in (1, 2):
- return space.newtext('cp%d' % rwin32.GetConsoleOutputCP())
+ return space.newtext('cp%d' % ccp)
from rpython.rlib import rlocale
if rlocale.HAVE_LANGINFO:
codeset = rlocale.nl_langinfo(rlocale.CODESET)
More information about the pypy-commit
mailing list