[PATCH] D61549: Fix use of 'is' operator for comparison

Raul Tambre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 4 02:05:03 PDT 2019


tambre created this revision.
tambre added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The 'is' operator is not meant to be used for comparisons. It currently working is an implementation detail of CPython.
CPython 3.8 has added a SyntaxWarning for this.


Repository:
  rC Clang

https://reviews.llvm.org/D61549

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
@@ -118,7 +118,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: D61549.198130.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190504/a790ffb4/attachment.bin>


More information about the cfe-commits mailing list