mirror of
https://github.com/openvswitch/ovs
synced 2025-10-23 14:57:06 +00:00
python: Remove reamining direct type comparisons.
I've hit several bugs in this Python 3 work where the fix was some code needed to be converted to use isinstance(). This has been primarily around deadling with the changes to unicode handling. Go ahead and convert the rest of the direct type comparisons to use isinstance(), as it could avoid a bug I haven't hit yet and it's more Pythonic, anyway. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -498,7 +498,7 @@ class Parser(object):
|
||||
|
||||
def __put_value(self, value):
|
||||
top = self.stack[-1]
|
||||
if type(top) == dict:
|
||||
if isinstance(top, dict):
|
||||
top[self.member_name] = value
|
||||
else:
|
||||
top.append(value)
|
||||
@@ -527,7 +527,7 @@ class Parser(object):
|
||||
else:
|
||||
self.stack.pop()
|
||||
top = self.stack[-1]
|
||||
if type(top) == list:
|
||||
if isinstance(top, list):
|
||||
self.parse_state = Parser.__parse_array_next
|
||||
else:
|
||||
self.parse_state = Parser.__parse_object_next
|
||||
|
||||
Reference in New Issue
Block a user