make with nested to work with 2.6
This commit is contained in:
parent
40ddd90e9b
commit
867cab7f25
|
@ -153,14 +153,16 @@ def _fbequal(fpath1, fpath2):
|
||||||
False otherwise.
|
False otherwise.
|
||||||
fpath1 and fpath2 are file paths.
|
fpath1 and fpath2 are file paths.
|
||||||
'''
|
'''
|
||||||
with open(fpath1, "rb") as f1, open(fpath2, "rb") as f2:
|
# nested to work with 2.6
|
||||||
while True:
|
with open(fpath1, "rb") as f1:
|
||||||
b1 = f1.read(1)
|
with open(fpath2, "rb") as f2:
|
||||||
b2 = f2.read(1)
|
while True:
|
||||||
if b1 != b2: # different bytes
|
b1 = f1.read(1)
|
||||||
return False
|
b2 = f2.read(1)
|
||||||
if not b1 or not b2: # end in one or both files
|
if b1 != b2: # different bytes
|
||||||
break
|
return False
|
||||||
|
if not b1 or not b2: # end in one or both files
|
||||||
|
break
|
||||||
if not b1 and not b2: # end in both files, files are equal
|
if not b1 and not b2: # end in both files, files are equal
|
||||||
return True
|
return True
|
||||||
# end in one file but not in the other, files aren't equal
|
# end in one file but not in the other, files aren't equal
|
||||||
|
|
Loading…
Reference in New Issue