Skip to content

Commit f3d8e5a

Browse files
committed
fixup
1 parent a1f4423 commit f3d8e5a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mig/shared/base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,9 @@ def force_utf8_rec(input_obj, highlight=''):
516516
if isinstance(input_obj, dict):
517517
return {force_utf8_rec(i, highlight): force_utf8_rec(j, highlight) for (i, j) in
518518
input_obj.items()}
519-
elif isinstance(input_obj, list):
520-
return [force_utf8_rec(i, highlight) for i in input_obj]
519+
elif isinstance(input_obj, (list, tuple)):
520+
thetype = type(input_obj)
521+
return thetype(force_utf8_rec(i, highlight) for i in input_obj)
521522
elif is_unicode(input_obj):
522523
return force_utf8(input_obj, highlight)
523524
else:
@@ -544,8 +545,9 @@ def force_unicode_rec(input_obj, highlight=''):
544545
if isinstance(input_obj, dict):
545546
return {force_unicode_rec(i, highlight): force_unicode_rec(j, highlight) for (i, j) in
546547
input_obj.items()}
547-
elif isinstance(input_obj, list):
548-
return [force_unicode_rec(i, highlight) for i in input_obj]
548+
elif isinstance(input_obj, (list, tuple)):
549+
thetype = type(input_obj)
550+
return thetype(force_utf8_rec(i, highlight) for i in input_obj)
549551
elif not is_unicode(input_obj):
550552
return force_unicode(input_obj, highlight)
551553
else:

0 commit comments

Comments
 (0)