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.

classification
Title: os.ttyname() accepts wrong arguments
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, docwhat
Priority: normal Keywords:

Created on 2004-12-07 16:32 by docwhat, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tmp.py docwhat, 2004-12-07 16:32 Test Case Code
Messages (2)
msg23577 - (view) Author: Christian Höltje (docwhat) Date: 2004-12-07 16:32
Problem:
  The doc for os.ttyname says it accepts an fd
What Happens:
  It raises a type error and says it expects an integer
instead.
  Experimentally, it seems to accept fd.fileno() as input
What should happen:
  It should an accept an fd (file object)

I have attached a test case for this.

The output I get using python 2.2 & 2.3 is:
Documentation Sez:
------------------------------------------------------------
ttyname(fd) -> String
Return the name of the terminal device connected to 'fd'.
------------------------------------------------------------

TTY Name (should work):    exceptions.TypeError an
integer is required
TTY Name (shouldn't work): /dev/pts/2

Ciao!
msg23578 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-12-28 20:42
Logged In: YES 
user_id=11375

No, file descriptors are small integers corresponding to a
file opened by the current process.  File descriptors are
not the same as file objects; as you've discovered, you can
get the file descriptor for a file object by calling the
.fileno() method.
History
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41293
2004-12-07 16:32:48docwhatcreate