Mateusz Loskot added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to