2
0
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:
Russell Bryant
2015-12-16 16:16:49 -05:00
parent eac25f500a
commit da2d45c6c6
7 changed files with 26 additions and 26 deletions

View File

@@ -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