Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b485224

Browse files
committed
REMOVE samefile(), sameopenfile(), samestat() -- these cannot be made
to work reliably (at least I wouldn't know how).
1 parent e365a59 commit b485224

2 files changed

Lines changed: 0 additions & 56 deletions

File tree

Lib/dospath.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -166,32 +166,6 @@ def isfile(path):
166166
return stat.S_ISREG(st[stat.ST_MODE])
167167

168168

169-
# Are two filenames really pointing to the same file?
170-
171-
def samefile(f1, f2):
172-
s1 = os.stat(f1)
173-
s2 = os.stat(f2)
174-
return samestat(s1, s2)
175-
176-
177-
# Are two open files really referencing the same file?
178-
# (Not necessarily the same file descriptor!)
179-
# XXX THIS IS BROKEN UNDER DOS! ST_INO seems to indicate number of reads?
180-
181-
def sameopenfile(fp1, fp2):
182-
s1 = os.fstat(fp1.fileno())
183-
s2 = os.fstat(fp2.fileno())
184-
return samestat(s1, s2)
185-
186-
187-
# Are two stat buffers (obtained from stat, fstat or lstat)
188-
# describing the same file?
189-
190-
def samestat(s1, s2):
191-
return s1[stat.ST_INO] == s2[stat.ST_INO] and \
192-
s1[stat.ST_DEV] == s2[stat.ST_DEV]
193-
194-
195169
# Is a path a mount point?
196170
# XXX This degenerates in: 'is this the root?' on DOS
197171

Lib/ntpath.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -189,36 +189,6 @@ def isfile(path):
189189
return stat.S_ISREG(st[stat.ST_MODE])
190190

191191

192-
# Are two filenames really pointing to the same file?
193-
194-
def samefile(f1, f2):
195-
"""Test whether two pathnames reference the same actual file"""
196-
s1 = os.stat(f1)
197-
s2 = os.stat(f2)
198-
return samestat(s1, s2)
199-
200-
201-
# Are two open files really referencing the same file?
202-
# (Not necessarily the same file descriptor!)
203-
# XXX THIS IS BROKEN UNDER DOS! ST_INO seems to indicate number of reads?
204-
205-
def sameopenfile(fp1, fp2):
206-
"""Test whether two open file objects reference the same file (may not
207-
work correctly)"""
208-
s1 = os.fstat(fp1.fileno())
209-
s2 = os.fstat(fp2.fileno())
210-
return samestat(s1, s2)
211-
212-
213-
# Are two stat buffers (obtained from stat, fstat or lstat)
214-
# describing the same file?
215-
216-
def samestat(s1, s2):
217-
"""Test whether two stat buffers reference the same file"""
218-
return s1[stat.ST_INO] == s2[stat.ST_INO] and \
219-
s1[stat.ST_DEV] == s2[stat.ST_DEV]
220-
221-
222192
# Is a path a mount point?
223193
# XXX This degenerates in: 'is this the root?' on DOS
224194

0 commit comments

Comments
 (0)