Merge mozilla-central to autoland. CLOSED TREE

--HG--
extra : rebase_source : b8f2ddf1c4cafdaa69093d306f4f3922bfd2acbd
extra : amend_source : e1568da3f97fd327d91a646913a3d7ab5241638a
This commit is contained in:
Mihai Alexandru Michis 2019-08-23 01:14:01 +03:00
Родитель f56c62c460 2466a0bc08
Коммит aeeeb2bb05
1 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -23,6 +23,7 @@ import sys
import time
from collections import (
Iterable,
OrderedDict,
)
from io import (
@ -1296,6 +1297,24 @@ def indented_repr(o, indent=4):
return ''.join(recurse_indented_repr(o, 0))
# Please do not use this function. It's only kept for backwards compatibility
# with older config.status files that may lay around before a CLOBBER.
def encode(obj, encoding='utf-8'):
'''Recursively encode unicode strings with the given encoding.'''
if isinstance(obj, dict):
return {
encode(k, encoding): encode(v, encoding)
for k, v in six.iteritems(obj)
}
if isinstance(obj, bytes):
return obj
if isinstance(obj, six.text_type):
return obj.encode(encoding)
if isinstance(obj, Iterable):
return [encode(i, encoding) for i in obj]
return obj
def patch_main():
'''This is a hack to work around the fact that Windows multiprocessing needs
to import the original main module, and assumes that it corresponds to a file