➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 makegho
收信人 ezio.melotti, makegho
日期 2012-12-01.00:23:51
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1354321432.5.0.798652538273.issue16587@psf.upfronthosting.co.za>
In-reply-to
内容
In a C application on Windows, at least on MSVC 2010 and Windows 7, do this:

wprintf(L"Test\n");
Py_Initialize();
wprintf(L"Test\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 breaks:

    if (dircheck(self, nameobj) < 0)
        goto error;

#if defined(MS_WINDOWS) || defined(__CYGWIN__)
    /* don't translate newlines (\r\n <=> \n) */
    _setmode(self->fd, O_BINARY); <----- breaks it
#endif

    if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
        goto error;

This can be easily confirmed by adding wprintfs on both sides of _setmode.

This issue was also raised at http://mail.python.org/pipermail/python-list/2012-February/620528.html but no solution was provided back then.
历史
日期 用户 动作 参数
2012-12-01 00:23:52makegho修改recipients: + makegho, ezio.melotti
2012-12-01 00:23:52makegho修改messageid: <1354321432.5.0.798652538273.issue16587@psf.upfronthosting.co.za>
2012-12-01 00:23:52makegho链接issue16587 messages
2012-12-01 00:23:51makegho创建