[issue16587] Py_Initialize breaks wprintf on Windows

2014-06-23 Thread Markus Kettunen
Markus Kettunen added the comment: It's quite common to use wide character strings to support Unicode in C and C++. In C++ this often means using std::wstring and std::wcout. Maybe these are more common than wprintf? In any case the console output breaks as Py_Initialize hijacks the host

[issue16587] Py_Initialize breaks wprintf on Windows

2014-06-23 Thread Markus Kettunen
Markus Kettunen added the comment: On Linux, std::wcout doesn't use wprintf(). Do you mean that std::wcout also depends on the mode of stdout (_setmode)? Yes, exactly. I originally noticed this bug by using std::wcout on Windows. -- ___ Python

[issue16587] Py_Initialize breaks wprintf on Windows

2012-11-30 Thread Markus Kettunen
New submission from Markus Kettunen: In a C application on Windows, at least on MSVC 2010 and Windows 7, do this: wprintf(LTest\n); Py_Initialize(); wprintf(LTest\n); Output is: Test T e s t I was able to track the issue to fileio.c to the following code block by searching where wprintf

[issue16587] Py_Initialize breaks wprintf on Windows

2012-11-30 Thread Markus Kettunen
Markus Kettunen added the comment: If the standard streams are not used through Python, this hack can be used to work around the bug on C side: #ifdef WIN32 #include fcntl.h #endif ... Py_Initialize(); #ifdef WIN32 _setmode(stdin-_file, O_TEXT); _setmode(stdout-_file, O_TEXT); _setmode