mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +00:00
python: KeyError shouldn't be raised from __getattr__
On Python 3 hasattr only intercepts AttributeError exception.
On Python2, instead, hasattr intercepts all the exceptions.
This means __getattr__ shouldn't return KeyError when the attribute
doesn't exists, but it should raise AttributeError instead.
Fixes: 2d54d8011e
("Python-IDL: getattr after mutate fix")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
committed by
Russell Bryant
parent
fd405262c9
commit
685e6983c6
@@ -774,7 +774,11 @@ class Row(object):
|
|||||||
assert self._changes is not None
|
assert self._changes is not None
|
||||||
assert self._mutations is not None
|
assert self._mutations is not None
|
||||||
|
|
||||||
|
try:
|
||||||
column = self._table.columns[column_name]
|
column = self._table.columns[column_name]
|
||||||
|
except KeyError:
|
||||||
|
raise AttributeError("%s instance has no attribute '%s'" %
|
||||||
|
(self.__class__.__name__, column_name))
|
||||||
datum = self._changes.get(column_name)
|
datum = self._changes.get(column_name)
|
||||||
inserts = None
|
inserts = None
|
||||||
if '_inserts' in self._mutations.keys():
|
if '_inserts' in self._mutations.keys():
|
||||||
|
Reference in New Issue
Block a user