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.

Author mloskot
Recipients V.E.O, amaury.forgeotdarc, brian.curtin, christian.heimes, m_python, mloskot, pitrou, tim.golden, tim.peters, vstinner
Date 2013-09-30.10:57:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380538630.17.0.264161429683.issue17797@psf.upfronthosting.co.za>
In-reply-to
Content
I have just tested Windows GUI application built against Python 3.2.1 with is_valid_fd patch according to http://hg.python.org/cpython/rev/f15943505db0/

All built using VS2012.

Again, I can confirm that is_valid_fd does NOT solve the problem.
Here is extract of execution flow in initstdio function:

1. fd = 0, despite it is GUI app, see https://connect.microsoft.com/VisualStudio/feedback/details/785119/

fd = fileno(stdin);

2. is_valid_fd will return __true__, so it moves to calling create_stdio()

if (!is_valid_fd(fd)) {
   ...
}
else {
   std = create_stdio(iomod, fd, 0, "<stdin>", encoding, errors);
   if (std == NULL)
       goto error;
}

3. The create_stdio() call fails though, causing error followed by abort


Still, the only solution that solves this problem in Windows GUI applications buitl using VS2012 is to use check_fd() function to check fd, instead of is_valid_fd(). The check_fd() is more reliable as it will return -1 due to errno == EBADF.

My previous attempt to analyse _PyVerify_fd() is not relevant for the problem, let's forget it.
History
Date User Action Args
2013-09-30 10:57:10mloskotsetrecipients: + mloskot, tim.peters, amaury.forgeotdarc, pitrou, vstinner, christian.heimes, tim.golden, brian.curtin, V.E.O, m_python
2013-09-30 10:57:10mloskotsetmessageid: <1380538630.17.0.264161429683.issue17797@psf.upfronthosting.co.za>
2013-09-30 10:57:10mloskotlinkissue17797 messages
2013-09-30 10:57:09mloskotcreate