Message187362
Replacing if the current test in Python 3.2
if (fd < 0)
with
if (check_fd(fd) < 0)
Seems to be a working solution.
I just noticed, that in current Python/pythonrun.c in the repo, there the fd < 0 tests have been replaced with new function is_valid_fd(). But, its semantic is equivalent to fd < 0, so it does not check anything really. Perhaps is_valid_fd could be redefined as check_fd.
Here are Visual C++ 11.0 (1700) vs 10.0 differences of fileno return value for all the standard streams
int fdi, fdo, fde;
fdi = fileno(stdin);
fdo = fileno(stdout);
fde = fileno(stderr);
#if _MSC_VER < 1700
assert(fdi == -2);
assert(fdo == -2);
assert(fde == -2);
#else
assert(fdi == 0);
assert(fdo == 1);
assert(fde == 2);
#endif
By the way, I assume such sudden change in fileno(std*) behaviour between Visual C++ versions is suspicious, so I also submitted bug report to Visual Studio:
https://connect.microsoft.com/VisualStudio/feedback/details/785119/ |
|
Date |
User |
Action |
Args |
2013-04-19 14:09:25 | mloskot | set | recipients:
+ mloskot, amaury.forgeotdarc |
2013-04-19 14:09:25 | mloskot | set | messageid: <1366380565.38.0.815023617781.issue17797@psf.upfronthosting.co.za> |
2013-04-19 14:09:25 | mloskot | link | issue17797 messages |
2013-04-19 14:09:25 | mloskot | create | |
|