|
10 | 10 | import stat |
11 | 11 | import genericpath |
12 | 12 | from genericpath import * |
| 13 | +from nt import _getfileinformation |
13 | 14 |
|
14 | 15 | __all__ = ["normcase","isabs","join","splitdrive","split","splitext", |
15 | 16 | "basename","dirname","commonprefix","getsize","getmtime", |
16 | 17 | "getatime","getctime", "islink","exists","lexists","isdir","isfile", |
17 | 18 | "ismount", "expanduser","expandvars","normpath","abspath", |
18 | 19 | "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", |
19 | 20 | "extsep","devnull","realpath","supports_unicode_filenames","relpath", |
20 | | - "samefile",] |
| 21 | + "samefile", "sameopenfile",] |
21 | 22 |
|
22 | 23 | # strings representing various path-related bits and pieces |
23 | 24 | # These are primarily for export; internally, they are hardcoded. |
@@ -652,3 +653,7 @@ def samefile(f1, f2): |
652 | 653 | # Also, on other operating systems, fake this method with a |
653 | 654 | # Windows-XP approximation. |
654 | 655 | return abspath(f1) == abspath(f2) |
| 656 | + |
| 657 | +def sameopenfile(f1, f2): |
| 658 | + """Test whether two file objects reference the same file""" |
| 659 | + return _getfileinformation(f1) == _getfileinformation(f2) |
0 commit comments