On 06/02/15 13:14, Amaury Forgeot d'Arc wrote:
2015-02-06 11:27 GMT+01:00 Armin Rigo <arigo@tunes.org>:
Hi,

On 6 February 2015 at 11:15, Amaury Forgeot d'Arc <amauryfa@gmail.com> wrote:
> This has other implications.
> For example, sys.stdout points to an invalid file descriptor,
> and I remember that old versions of pythonw.exe used to freeze after
> printing 8192 characters.

I'm not finding anything special done with stdout if we're
pythonw.exe.  Can you be more specific?

CPython3 has this code to set sys.stdout to None in this case:
https://hg.python.org/cpython/file/v3.3.4/Python/pythonrun.c#l1083

But that's probably only for python3, python2 chose to not change anything:
http://bugs.python.org/issue706263
 
Otherwise I suppose the way forward is to produce pypyw.exe (by
editing rpython/translator/platform/windows.py, gen_makefile(), rule
for $(DEFAULT_TARGET), to run $(CC_LINK) twice instead of once), and
then to wait until people report issues with it.


A bientôt,

Armin.



--
Amaury Forgeot d'Arc

I merged pypyw which simply creates another exe, in line with what Armin suggested. Amaury, it is not clear to me how stdout is set to None since AFAICT is_valid_fd(stdout) passes, at least in the rpython test I tried. To reproduce: run test_shared in translator/c/test_standalone.py, then run the resulting test-1w.exe as

test-1.exe a b 2>err.txt

It will print a rpython exception to err.txt indicating that it failed in the actual write, not in the is_valid_fd(stdout) test just before the write.

Matti