https://bugs.llvm.org/show_bug.cgi?id=44162

            Bug ID: 44162
           Summary: Python 3.8 emits SyntaxWarning for "is" with a literal
                    in clang-format.py
           Product: clang
           Version: 9.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: lukas.karnow...@gmail.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Since Python 3.8 a SyntaxWarning is emitted if a literal is compared with "is"
or "is not". Currently clang-format.py:123 uses the following comparison, which
produces the warning:
if op[0] is not 'equal':

Reproducable with Python 3.8:
> python --version
Python 3.8.0
> python
>>> "foo" is "bar"
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
False

Additional information: https://bugs.python.org/issue34850

The solution is simply to use "!=" instead of "is not".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to