ImageFileDirectory_v1 does not raise KeyError

This commit is contained in:
Andrew Murray 2019-09-07 18:31:23 +10:00
parent f3ed44a566
commit ef16cb8efe

View File

@ -3327,19 +3327,13 @@ class Exif(MutableMapping):
return tag in self return tag in self
def __setitem__(self, tag, value): def __setitem__(self, tag, value):
if self._info is not None: if self._info is not None and tag in self._info:
try:
del self._info[tag] del self._info[tag]
except KeyError:
pass
self._data[tag] = value self._data[tag] = value
def __delitem__(self, tag): def __delitem__(self, tag):
if self._info is not None: if self._info is not None and tag in self._info:
try:
del self._info[tag] del self._info[tag]
except KeyError:
pass
del self._data[tag] del self._data[tag]
def __iter__(self): def __iter__(self):