Remove Python 3-specific conditional in dump_as_bytes
Now that we only support Python 3 we don't need logic to handle Python 2. Change-Id: I33747d25bc4c67ee13654ed132edf7413371c1dc
This commit is contained in:
parent
ad356ea9c2
commit
909c17a779
@ -214,11 +214,7 @@ def dump_as_bytes(obj, default=to_primitive, encoding='utf-8', **kwargs):
|
||||
|
||||
.. versionadded:: 1.10
|
||||
"""
|
||||
serialized = dumps(obj, default=default, **kwargs)
|
||||
if isinstance(serialized, str):
|
||||
# On Python 3, json.dumps() returns Unicode
|
||||
serialized = serialized.encode(encoding)
|
||||
return serialized
|
||||
return dumps(obj, default=default, **kwargs).encode(encoding)
|
||||
|
||||
|
||||
def dump(obj, fp, *args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user