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.

Author jemfinch
Recipients
Date 2004-08-03.03:35:35
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
At http://docs.python.org/lib/module-os.path.html it very clearly 
states this:

sameopenfile(fp1, fp2)

Return True if the file objects fp1 and fp2 refer to the same file. 
The two file objects may represent different file descriptors. 
Availability: Macintosh, Unix.

However, on my OSX box, the source to posixpath.py clearly says 
otherwise:

def sameopenfile(fp1, fp2):
    """Test whether two open file objects reference the same file"""
    s1 = os.fstat(fp1)
    s2 = os.fstat(fp2)
    return samestat(s1, s2)

I.e., sameopenfile accepts two integer filenos, not two file objects.  
Running it gives this exception:

  File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/supybot/plugins/Tail.py", line 77, 
in samefile
    return os.path.sameopenfile(fd1, fd2)
  File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/posixpath.py", line 220, in sameopenfile
    s1 = os.fstat(fp1)
TypeError: an integer is required

Perhaps the (much more useful) documented behavior can be 
retained, and two if statements added to the definition of 
sameopenfile:

if not isinstance(fp1, int): fp1 = fp1.fileno()
if not isinstance(fp2, int): fp2 = fp2.fileno()
History
Date User Action Args
2007-08-23 14:24:46adminlinkissue1002398 messages
2007-08-23 14:24:46admincreate