[ python-Bugs-1080713 ] os.ttyname() accepts wrong arguments

SourceForge.net noreply at sourceforge.net
Tue Dec 28 21:42:55 CET 2004


Bugs item #1080713, was opened at 2004-12-07 11:32
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1080713&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Christian Höltje (docwhat)
>Assigned to: A.M. Kuchling (akuchling)
Summary: os.ttyname() accepts wrong arguments

Initial Comment:
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!


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2004-12-28 15:42

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1080713&group_id=5470


More information about the Python-bugs-list mailing list