Revert "Explicitly raise ValueError in to_primitive"
This reverts commit 3727b2d6e051b7b07680df361f38b9dbb576462c. It breaks nova's test, need log warning before we make major release. Change-Id: Ibbfde6207fc8c066155758c7c1aa1521b95d4db1
This commit is contained in:
parent
790d1d12d0
commit
bbee6d1aa1
@ -167,7 +167,7 @@ def to_primitive(value, convert_instances=False, convert_datetime=True,
|
||||
# __iter__ defined but it isn't callable as list().
|
||||
return six.text_type(value)
|
||||
|
||||
raise ValueError("Cannot convert %r to primitive" % (value,))
|
||||
return value
|
||||
|
||||
|
||||
JSONEncoder = json.JSONEncoder
|
||||
|
@ -254,7 +254,7 @@ class ToPrimitiveTestCase(test_base.BaseTestCase):
|
||||
self.assertEqual(dict(b=1),
|
||||
jsonutils.to_primitive(x, convert_instances=True))
|
||||
|
||||
self.assertRaises(ValueError, jsonutils.to_primitive, x)
|
||||
self.assertEqual(x, jsonutils.to_primitive(x))
|
||||
|
||||
def test_typeerror(self):
|
||||
x = bytearray # Class, not instance
|
||||
|
Loading…
x
Reference in New Issue
Block a user