Issue 18553: os.isatty() is not Unix only (original) (raw)

Issue18553

Created on 2013-07-25 11:46 by techtonik, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (17)
msg193694 - (view) Author: anatoly techtonik (techtonik) Date: 2013-07-25 11:46
It seems like os.isatty(0) works on Windows too. Documentation says Unix only: http://docs.python.org/2/library/os.html#os.isatty http://docs.python.org/3.4/library/os.html#os.isatty C:\>py -c "import os; print os.isatty(0)" True C:\>echo "x" | py -c "import os; print os.isatty(0)" False C:\>py -c "import os; print os.isatty(0)" more True
msg195479 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-17 15:02
Are there tests for this?
msg196718 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-01 09:45
None that I know of.
msg196725 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-09-01 17:48
> Are there tests for this? Not sure what you mean: there are several tests using isatty() in test suite. Regardless, there is no #ifdef around the isatty() definition in posixmodule.c, so I can only assume it exists on all platforms.
msg196796 - (view) Author: Dmi Baranov (dmi.baranov) * Date: 2013-09-02 17:50
isatty is a part of of POSIX sub-system at Windows > 5.x (AKA 2000) [1] (file handling equivalents [2]). I think, we need to remove availability note here. [1] http://msdn.microsoft.com/en-us/library/f4s0ddew.aspx [2] http://msdn.microsoft.com/en-us/library/kdfaxaay.aspx
msg196822 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2013-09-03 03:53
Agree
msg197175 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-07 18:30
New changeset d5c5ac33b9a1 by Senthil Kumaran in branch '2.7': os.isatty is not Unix only. Correct the wrong documentation. http://hg.python.org/cpython/rev/d5c5ac33b9a1
msg197176 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-07 18:31
I have corrected the documentation. Thanks for raising this issue, anatoly techtonik.
msg197672 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-09-13 22:11
Why only changing Python 2 documentation? http://docs.python.org/dev/library/os.html#os.isatty still mention "Availability: Unix."
msg197676 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-13 22:42
I had removed them in all. Something must have gone wrong if still present or I did a mistake. changeset: 85594:678e3c0d2d99 parent: 85591:c116b658aede parent: 85593:14ba90816930 user: Senthil Kumaran <senthil@uthcode.com> date: Sat Sep 07 11:30:04 2013 -0700 files: Doc/library/os.rst description: merge from 3.3 Removing the mention of os.isatty mention as Unix only Correct the wrong documentation. changeset: 85593:14ba90816930 branch: 3.3 parent: 85589:dd669daad7de user: Senthil Kumaran <senthil@uthcode.com> date: Sat Sep 07 11:28:58 2013 -0700 files: Doc/library/os.rst description: Removing the mention of os.isatty mention as Unix only Correct the wrong documentation. changeset: 85592:d5c5ac33b9a1 branch: 2.7 parent: 85588:523cfc78847c user: Senthil Kumaran <senthil@uthcode.com>
msg197967 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-09-17 07:58
Senthil: your 3.3->default merge removed the Availability from fpathconf().
msg198041 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-19 06:10
Georg: Thanks for spotting. I feel bad for the mistake. I shall correct it.
msg198043 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-19 07:10
New changeset 2b7f11ba871c by Senthil Kumaran in branch '3.3': Correcting the mistake in 14ba90816930 http://hg.python.org/cpython/rev/2b7f11ba871c New changeset e839e524a7d5 by Senthil Kumaran in branch 'default': Correcting the mistake in 678e3c0d2d99 http://hg.python.org/cpython/rev/e839e524a7d5
msg198044 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-19 07:12
Fixed now. Ascertained myself by doing hg diff -r tip^ -U 10 on local commits before pushing. :-)
msg198079 - (view) Author: Dmi Baranov (dmi.baranov) * Date: 2013-09-19 14:47
I found a little difference in isatty implementaions: Windows Determines whether a file descriptor is associated with a character device [1] Unix Test whether a file descriptor refers to a terminal [2] So, we having a same behavior for pipes, but different for I/O redirection with pseudo-character devices: $ ./python -c "import os;print(os.isatty(0))" < /dev/null False e:\PCbuild>python_d.exe -c "import os;print(os.isatty(0))" < NUL True Other pseudo devices works simular: e:\PCbuild>python_d.exe -c "import os;print(os.isatty(0))" < CON True I having a snippet to fix that, should I open a new issue for patch? [1] http://msdn.microsoft.com/en-us/library/f4s0ddew.aspx [2] http://man7.org/linux/man-pages/man3/isatty.3.html
msg198081 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-09-19 15:16
Hello Dmi, > I having a snippet to fix that, should I open a new issue for patch? Please open a new issue. Thanks!
msg198271 - (view) Author: anatoly techtonik (techtonik) Date: 2013-09-22 12:12
> > > I having a snippet to fix that, should I open a new issue for patch? > > Please open a new issue. > Reference is welcome.
History
Date User Action Args
2022-04-11 14:57:48 admin set github: 62753
2015-04-06 04:48:01 berker.peksag set stage: needs patch -> resolved
2013-09-22 12:12:44 techtonik set messages: +
2013-09-19 15:16:44 orsenthil set messages: +
2013-09-19 14:47:28 dmi.baranov set messages: +
2013-09-19 07:12:55 orsenthil set status: open -> closedmessages: +
2013-09-19 07:10:24 python-dev set messages: +
2013-09-19 06:10:50 orsenthil set messages: +
2013-09-17 07:58:42 georg.brandl set status: closed -> opennosy: + georg.brandlmessages: +
2013-09-13 22:42:03 orsenthil set messages: +
2013-09-13 22:11:48 vstinner set nosy: + vstinnermessages: +
2013-09-07 18:31:21 orsenthil set status: open -> closednosy: + orsenthilmessages: + resolution: fixed
2013-09-07 18:30:15 python-dev set nosy: + python-devmessages: +
2013-09-03 03:53:40 asvetlov set nosy: + asvetlovmessages: +
2013-09-02 17:51:00 dmi.baranov set nosy: + dmi.baranovmessages: +
2013-09-01 17:48:36 pitrou set nosy: + pitroumessages: +
2013-09-01 09:45:54 techtonik set messages: +
2013-08-17 15:02:20 ezio.melotti set nosy: + ezio.melottimessages: + components: + Testskeywords: + easy
2013-07-27 01:19:53 terry.reedy set stage: needs patchtype: behaviorversions: - Python 3.1, Python 3.2, Python 3.5
2013-07-25 12:51:46 techtonik set assignee: docs@pythoncomponents: + Documentationnosy: + docs@python
2013-07-25 11:46:19 techtonik create