Fix types issue for Python 2/3 compatible code.
replace types.NoneType with type(None) replace types.DictType with dict Story: 2003430 Task: 27481 Change-Id: I835b1c086267b05bedb454a0d2eaaeef58254dae Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
parent
b4049622ec
commit
d9c7f0bc2f
|
@ -42,7 +42,6 @@ import functools
|
|||
import inspect
|
||||
import itertools
|
||||
import json
|
||||
import types
|
||||
import xmlrpclib
|
||||
|
||||
import six
|
||||
|
@ -56,7 +55,7 @@ _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
|
|||
inspect.iscode, inspect.isbuiltin, inspect.isroutine,
|
||||
inspect.isabstract]
|
||||
|
||||
_simple_types = (types.NoneType, int, six.string_types, bool, float, long)
|
||||
_simple_types = (type(None), int, six.string_types, bool, float, long)
|
||||
|
||||
|
||||
def to_primitive(value, convert_instances=False, convert_datetime=True,
|
||||
|
|
|
@ -747,7 +747,7 @@ def _call(addr, context, topic, msg, timeout=None,
|
|||
# One effect of this is that we're checking all
|
||||
# responses for Exceptions.
|
||||
for resp in responses:
|
||||
if isinstance(resp, types.DictType) and 'exc' in resp:
|
||||
if isinstance(resp, dict) and 'exc' in resp:
|
||||
raise rpc_common.deserialize_remote_exception(CONF, resp['exc'])
|
||||
|
||||
return responses[-1]
|
||||
|
|
Loading…
Reference in New Issue