Skip to content

Commit 12341f8

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents aa55700 + 6187697 commit 12341f8

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

test/Incremental/Verifier/gen-output-file-map.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
import sys
1010

1111

12+
# Python 2 `unicode` was renamed `str` in Python 3. To consistently support
13+
# both, define `unicode` to be `str` when using Python 3. Once we can drop
14+
# Python 2 support, delete this and change all uses of `unicode` to `str`.
15+
if sys.version_info[0] >= 3:
16+
unicode = str
17+
18+
1219
def fatal(msg):
1320
print(msg, file=sys.stderr)
1421
sys.exit(1)
@@ -62,21 +69,14 @@ def main(arguments):
6269
'swift-dependencies': './main-buildrecord.swiftdeps'
6370
}
6471

65-
# TODO: this is for python 2 and python 3 compatibility. Once Python 2 is
66-
# removed, this function can be removed.
67-
def to_unicode(r):
68-
if sys.version_info[0] < 3:
69-
return unicode(r)
70-
return str(r)
71-
7272
with io.open(output_path, 'w', encoding='utf-8', newline='\n') as f:
73-
f.write(to_unicode(json.dumps(all_records, ensure_ascii=False)))
73+
f.write(unicode(json.dumps(all_records, ensure_ascii=False)))
7474

7575
if args.response_output_file is not None:
7676
with io.open(args.response_output_file, 'w',
7777
encoding='utf-8', newline='\n') as f:
7878
for line in response_file_contents:
79-
f.write(to_unicode(line + " "))
79+
f.write(unicode(line + " "))
8080

8181

8282
if __name__ == '__main__':

utils/round-trip-syntax-test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ from functools import reduce
1414
logging.basicConfig(format='%(message)s', level=logging.INFO)
1515

1616

17+
# Python 2 `unicode` was renamed `str` in Python 3. To consistently support
18+
# both, define `unicode` to be `str` when using Python 3. Once we can drop
19+
# Python 2 support, delete this and change all uses of `unicode` to `str`.
20+
# (Currently, this is only here to avoid a python_lint failure from unicode
21+
# references below.)
22+
if sys.version_info[0] >= 3:
23+
unicode = str
24+
25+
1726
class RoundTripTask(object):
1827
def __init__(self, input_filename, action, swift_syntax_test,
1928
skip_bad_syntax):

utils/update_checkout/tests/test_update_worktree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
import os
1414

15-
from scheme_mock import call_quietly
16-
1715
from . import scheme_mock
16+
from .scheme_mock import call_quietly
17+
1818

1919
WORKTREE_NAME = "feature"
2020

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def update_single_repository(pool_args):
166166
result = shell.run(['git', 'rev-parse', checkout_target])
167167
revision = result[0].strip()
168168
shell.run(['git', 'checkout', revision], echo=True)
169-
except Exception as e:
169+
except Exception:
170170
raise originalException
171171

172172
# It's important that we checkout, fetch, and rebase, in order.

0 commit comments

Comments
 (0)