[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2016-06-07 Thread Mark Lawrence
Changes by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2016-06-06 Thread Sophie
Sophie added the comment: In case someone else need it, here is a patch for python 3.5.0b1 -- nosy: +Sopouic versions: +Python 3.5 -Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file43259/python-3.5.0b1-fdvalidation.patch ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-08-23 Thread Ilya Kulakov
Ilya Kulakov added the comment: Steve, What's going to be the required msvc compiler for 3.5 on Windows? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-08-23 Thread eryksun
eryksun added the comment: The 3.5 build uses MSVC 14 (VS 2015): https://docs.python.org/3.5/using/windows.html#compiling-python-on-windows https://hg.python.org/cpython/file/3.5/PCbuild/readme.txt -- nosy: +eryksun ___ Python tracker

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-08-15 Thread Steve Dower
Steve Dower added the comment: Rereading the discussion, there seems to be agreement that this is an enhancement. It does not apply for Python 3.5 (which requires a compiler without the bug that causes this), and Python 3.4 is no longer eligible for enhancements. I'm closing this as out of

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-08-15 Thread Ilya Kulakov
Ilya Kulakov added the comment: I see issue to be fixed but patch wasn't applied yet. Is it still supposed to be included in 3.5 or there is something wrong? -- nosy: +Ilya.Kulakov ___ Python tracker rep...@bugs.python.org

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-05-20 Thread Mateusz Loskot
Mateusz Loskot added the comment: Re msg238016, I confirm python-3.5.0a2-fdvalidation.patch fixes the problem for Python 3.5.0a4 and VS2013. The only issue I encountered was with HAVE_FSTAT which is missing from PC/pyconifg.h, so I edited the patch and removed the check if

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-03-13 Thread Jean-Charles Lefebvre
Jean-Charles Lefebvre added the comment: Well, just in case, I've attached the patch to apply against 3.5.0a2. -- Added file: http://bugs.python.org/file38469/python-3.5.0a2-fdvalidation.patch ___ Python tracker rep...@bugs.python.org

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-03-12 Thread Jean-Charles Lefebvre
Jean-Charles Lefebvre added the comment: Oops, mistyping, #ifdef test would be: #if defined(MS_WINDOWS) defined(HAVE_FSTAT) defined(_MSC_VER) _MSC_VER = 1700 _MSC_VER 1900 -- ___ Python tracker rep...@bugs.python.org

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-03-12 Thread Jean-Charles Lefebvre
Jean-Charles Lefebvre added the comment: Hi all, a small update to confirm this issue with version 3.5.0a2 embedded in a native C++ GUI application, having everything built with VS2013 SP4. Same execution flow as described by Mateusz in msg198689. I've modified Python/pylifecycle.c file

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-03-12 Thread Steve Dower
Steve Dower added the comment: There's not much point putting this into 3.5 anymore, as we are going to break pre-VS2015 builds completely sooner or later (too many changes to the CRT that we can't just work around with #ifdefs - and too much opposition to having code purely to support

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Tomasz Wasilczyk
Tomasz Wasilczyk added the comment: It seems that bug remains *not* fixed. Just like eaducac pointed out, there are cases when underlying file handle is -2, which is not a valid file handle, but *is* a valid handle (which is GetCurrentThread). Thus, provided dup solution accepts it, while it

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread STINNER Victor
STINNER Victor added the comment: @steve.dower: Do you have info on this issue? -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Steve Dower
Steve Dower added the comment: This is fixed in VS2015 last time I tried it. I've proposed workarounds for this before, but it's never affected any official build do there's never been any traction. The fstat patch is normally the check that I use. I don't know what Tomasz means that it's not

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Tomasz Wasilczyk
Tomasz Wasilczyk added the comment: I don't mean fixing VS, but providing a workaround in Python code, when compiled with VS2012. I know newer VS versions are fixed. Do you mean, VS2012 is not supported? If it's not - then LibreOffice team have a problem, because their official release is

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Mark Lawrence
Mark Lawrence added the comment: An enhancement can only go into 3.5, not 3.4. This has to happen before beta 1 which is currently scheduled for May 24 2015. I'm against the idea as it would create too many compatibility issues. -- nosy: +BreamoreBoy

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Steve Dower
Steve Dower added the comment: It's not supported for building Python, is what I meant. I don't know what the status is for Microsoft support of VS2012, but I'd expect it's security fix only by now. Being able to support building Python with alternative compilers is a task that we don't have

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2015-01-29 Thread Tomasz Wasilczyk
Tomasz Wasilczyk added the comment: In such case, I agree it's an enhancement, not a bugfix. Could go into 3.5 branch. How about changing the ifdef to the following, to avoid any issues on non-MSVS2012: #if defined(MS_WINDOWS) defined(HAVE_FSTAT) defined(_MSC_VER) _MSC_VER == 1700

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2014-08-18 Thread Bastien Montagne
Changes by Bastien Montagne b.mon...@gmail.com: -- nosy: +mont29 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___ ___ Python-bugs-list

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2014-08-18 Thread Brian Curtin
Changes by Brian Curtin br...@python.org: -- nosy: -brian.curtin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___ ___ Python-bugs-list

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2014-06-21 Thread Mateusz Loskot
Mateusz Loskot added the comment: FYI, I've got it confirmed fix for the bug in VS has been released [1] We have fixed this behavior for the next major release, Visual Studio 14. The fix is present in the Visual Studio 14 CTP that was released earlier this month. [1]

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2014-05-05 Thread Luke Dunstan
Changes by Luke Dunstan lukedunsta...@gmail.com: -- nosy: +Luke.Dunstan versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-11-01 Thread eaducac
eaducac added the comment: Hi all, I ran into this problem myself today with 3.3.2 and I thought I'd provide some more detail on what's going on. As has been described, prior to VC11, fileno(stdin) returned -2 in applications with no console, so is_valid_fd() was properly rejecting it and

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-30 Thread Mateusz Loskot
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

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-12 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: 2. _PyVerify_fd(fd) is always true. Given the current definition: #define _PyVerify_fd(fd) (_get_osfhandle(fd) = 0) for those values of fd _get_osfhandle(fd) = 0, always. Hum, are you sure this is the selected implementation? - this code is only in 2.7

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Daniel
Daniel added the comment: Here are some solutions which might help you until MS fixed the bug. 1) Even if the subsystem is Windows one solution is to call AllocConsole() before Py_Initialize() to create a console. 2) Second Solution: If you don't want to open a console and your application

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brian.curtin, tim.golden, tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- priority: normal - high resolution: out of date - stage: - needs patch versions: +Python 3.3, Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Which 3.2 version does this break with? As far as I can tell, it should be fixed in 3.2.3: see changeset f15943505db0, issue #7111. -- nosy: +pitrou resolution: - fixed stage: needs patch - status: open - pending versions: +Python 3.2 -Python 3.3,

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot
Mateusz Loskot added the comment: @Antoine (Re msg197480) I'm not sure which minor version of Python 3.2 it was, but in my comment in msg187362, I confirmed that I have tested the later version with added is_valid_fd function. As far as I understand, the changes in

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Daniel
Daniel added the comment: Sorry, I used the latest Python3.4 branch, I haven't tested this with prior versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure which minor version of Python 3.2 it was, but in my comment in msg187362, I confirmed that I have tested the later version with added is_valid_fd function. As far as I understand, the changes in http://hg.python.org/cpython/rev/f15943505db0/

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot
Mateusz Loskot added the comment: On 11 September 2013 12:34, Antoine Pitrou rep...@bugs.python.org wrote: I'm not sure which minor version of Python 3.2 it was, but in my comment in msg187362, I confirmed that I have tested the later version with added is_valid_fd function. As far as I

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Shortly, is_valid_fd always returns true because fd 0 is always false as my tests with Visual Studio 2012 Well, that's not all there is, is_valid_fd() does other checks before returning true. -- ___ Python

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-11 Thread Mateusz Loskot
Mateusz Loskot added the comment: On 12 September 2013 00:06, Antoine Pitrou rep...@bugs.python.org wrote: Shortly, is_valid_fd always returns true because fd 0 is always false as my tests with Visual Studio 2012 Well, that's not all there is, is_valid_fd() does other checks before

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-09-10 Thread Daniel
Daniel added the comment: After contacting Microsoft they answered that they cannot fix that within the VS2012 or VS2013 cycle. Very bad. Any ideas? -- nosy: +m_python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-07-08 Thread Mateusz Loskot
Mateusz Loskot added the comment: This is still an issue in VS 2012 Version 11.0.60610.01 Update 3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-07-07 Thread V.E.O
V.E.O added the comment: Hi Christian, The latest runtime Microsoft provided is buggy. Tried fix the PyVerify_fd with more GetFileType verification. But a lot more problems came for isatty returns true in non-console program. The fix in Python side shall be large. Details is reported to

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-07-06 Thread V.E.O
V.E.O added the comment: Tested on MSVCRT110.DLL (11.0.51106.1 released in 2012/11/05). Previous one 11.0.50727.1 released in 2012/07/26 does not have this problem. This problem better be fixed in Python for MS does not have clear document. -- nosy: +V.E.O

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-07-06 Thread Christian Heimes
Christian Heimes added the comment: Python 3.2 is in security fix mode. Bug fixes such as this issue don't count as security fix. Are you able to update to Python 3.3? Python 2.7 has a different implementation and uses FILE* instead of file descriptors. -- components: +Windows nosy:

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-29 Thread Mateusz Loskot
Mateusz Loskot added the comment: I've just got an update on the bug report [1] I submitted to Microsoft. The Visual C++ team confirmed It does appear to be a regression from Visual Studio 2010. So, it's not a bug in Python, but I think it may be important for Python to consider applying some

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-29 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___ ___ Python-bugs-list

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Mateusz Loskot
New submission from Mateusz Loskot: In pythonrun.c, there is function initstdio() with the following test: static int initstdio(void) { ... /* Set sys.stdin */ fd = fileno(stdin); /* Under some conditions stdin, stdout and stderr may not be connected * and fileno() may point to

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: And does it cause an issue later? How? -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797 ___

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Mateusz Loskot
Mateusz Loskot added the comment: Yes, it does. In file Modulfileio.c, in function fileio_init, there is this code: if (fd = 0) { if (check_fd(fd)) goto error; self-fd = fd; self-closefd = closefd; } The check_fd tests: if (!_PyVerify_fd(fd) ||

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Mateusz Loskot
Mateusz Loskot added the comment: In file Modulfileio.c, I messed the path and filename above I meant: In file Modules/_io/fileio.c, -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17797

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Maybe check_fd(fd) could be used in initstdio as well. Can you check whether it's the same for the other files? What are the values for fileno(stdout) and fileno(stderr)? -- ___ Python tracker

[issue17797] Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program

2013-04-19 Thread Mateusz Loskot
Mateusz Loskot added the comment: 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,