mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-13 22:03:04 +00:00
In PyPy encode() doesn't call iterencode().
This commit is contained in:
parent
08cb514eee
commit
e090891935
@ -61,6 +61,10 @@ class UTF8BytesJSONEncoder(json.JSONEncoder):
|
||||
"""
|
||||
A JSON encoder than can also encode UTF-8 encoded strings.
|
||||
"""
|
||||
def encode(self, o, **kwargs):
|
||||
return json.JSONEncoder.encode(
|
||||
self, _bytes_to_unicode(False, o), **kwargs)
|
||||
|
||||
def iterencode(self, o, **kwargs):
|
||||
return json.JSONEncoder.iterencode(
|
||||
self, _bytes_to_unicode(False, o), **kwargs)
|
||||
@ -73,6 +77,10 @@ class AnyBytesJSONEncoder(json.JSONEncoder):
|
||||
Bytes are decoded to strings using UTF-8, if that fails to decode then the
|
||||
bytes are quoted.
|
||||
"""
|
||||
def encode(self, o, **kwargs):
|
||||
return json.JSONEncoder.encode(
|
||||
self, _bytes_to_unicode(True, o), **kwargs)
|
||||
|
||||
def iterencode(self, o, **kwargs):
|
||||
return json.JSONEncoder.iterencode(
|
||||
self, _bytes_to_unicode(True, o), **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user