[llvm-bugs] [Bug 44162] New: Python 3.8 emits SyntaxWarning for "is" with a literal in clang-format.py
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 27 06:24:29 PST 2019
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: unassignedclangbugs at nondot.org
Reporter: lukas.karnowski at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191127/ab1f18b3/attachment.html>
More information about the llvm-bugs
mailing list