Bugs item #1002398, was opened at 2004-08-03 03:35 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1002398&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.3 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Jeremy Fincher (jemfinch) Assigned to: Nobody/Anonymous (nobody) Summary: os.path.sameopenfile documentation wrong. Initial Comment: 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() ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-07-30 11:08 Message: Logged In: YES user_id=849994 The function is not needed so often to warrant a implementation change. Fixed the docs in rev. 50974, 50975 (2.4). ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-07-08 21:48 Message: Logged In: YES user_id=1188172 The question is, should we fix the docs or the implementation? Or add the suggested hybrid-solution (drawback: no other function that deals with files currently allows file objects and descriptors). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1002398&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com