[PATCH] D70664: update string comparison in clang-format.py
Paul Seyfert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 25 04:05:41 PST 2019
pseyfert created this revision.
pseyfert added reviewers: MyDeveloperDay, klimek, llvm-commits, cfe-commits.
pseyfert added a project: clang-format.
Herald added a project: clang.
Python 3.8 introduces a SyntaxWarning about string comparisons with 'is'. This commit updates the string comparison in clang-format.py that is done with 'is not' to '!='. This should not break compatibility with older python versions (tested 3.4.9, 2.7.17, 2.7.5, 3.8.0).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70664
Files:
clang/tools/clang-format/clang-format.py
Index: clang/tools/clang-format/clang-format.py
===================================================================
--- clang/tools/clang-format/clang-format.py
+++ clang/tools/clang-format/clang-format.py
@@ -132,7 +132,7 @@
lines = lines[1:]
sequence = difflib.SequenceMatcher(None, buf, lines)
for op in reversed(sequence.get_opcodes()):
- if op[0] is not 'equal':
+ if op[0] != 'equal':
vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]
if output.get('IncompleteFormat'):
print('clang-format: incomplete (syntax errors)')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70664.230873.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191125/16706f7b/attachment.bin>
More information about the cfe-commits
mailing list