This fixes a "bytes-like object is required, not 'str'" python3 error I hit on update_llc_test_checks.py (but present on the other scripts as well) by matching what update_mca_test_checks.py already does, plus I've added an explicit 'utf-8' encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352633
91177308-0d34-0410-b5e6-
96231b3b80d8
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':
'Writing {} lines to {}...\n\n'.format(len(output_lines), test_path))
with open(test_path, 'wb') as f:
- f.writelines(['{}\n'.format(l).encode() for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
def main():
args = _parse_args()
print('Writing %d lines to %s...' % (len(output_lines), test), file=sys.stderr)
with open(test, 'wb') as f:
- f.writelines([l + '\n' for l in output_lines])
+ f.writelines(['{}\n'.format(l).encode('utf-8') for l in output_lines])
if __name__ == '__main__':