Renamed "file" variable to "fp"

This commit is contained in:
Andrew Murray 2019-02-05 20:30:44 +11:00
parent 0481d0ac1e
commit d1df192e81

View File

@ -459,36 +459,36 @@ def _getexif(self):
data = self.info["exif"] data = self.info["exif"]
except KeyError: except KeyError:
return None return None
file = io.BytesIO(data[6:]) fp = io.BytesIO(data[6:])
head = file.read(8) head = fp.read(8)
# process dictionary # process dictionary
info = TiffImagePlugin.ImageFileDirectory_v1(head) info = TiffImagePlugin.ImageFileDirectory_v1(head)
file.seek(info.next) fp.seek(info.next)
info.load(file) info.load(fp)
exif = dict(_fixup_dict(info)) exif = dict(_fixup_dict(info))
# get exif extension # get exif extension
try: try:
# exif field 0x8769 is an offset pointer to the location # exif field 0x8769 is an offset pointer to the location
# of the nested embedded exif ifd. # of the nested embedded exif ifd.
# It should be a long, but may be corrupted. # It should be a long, but may be corrupted.
file.seek(exif[0x8769]) fp.seek(exif[0x8769])
except (KeyError, TypeError): except (KeyError, TypeError):
pass pass
else: else:
info = TiffImagePlugin.ImageFileDirectory_v1(head) info = TiffImagePlugin.ImageFileDirectory_v1(head)
info.load(file) info.load(fp)
exif.update(_fixup_dict(info)) exif.update(_fixup_dict(info))
# get gpsinfo extension # get gpsinfo extension
try: try:
# exif field 0x8825 is an offset pointer to the location # exif field 0x8825 is an offset pointer to the location
# of the nested embedded gps exif ifd. # of the nested embedded gps exif ifd.
# It should be a long, but may be corrupted. # It should be a long, but may be corrupted.
file.seek(exif[0x8825]) fp.seek(exif[0x8825])
except (KeyError, TypeError): except (KeyError, TypeError):
pass pass
else: else:
info = TiffImagePlugin.ImageFileDirectory_v1(head) info = TiffImagePlugin.ImageFileDirectory_v1(head)
info.load(file) info.load(fp)
exif[0x8825] = _fixup_dict(info) exif[0x8825] = _fixup_dict(info)
return exif return exif