New SyntaxWarning for ‘is’ with literals starting with Python 3.8
New SyntaxWarning for 'is' with literals starting with Python 3.8
The compiler now produces a
SyntaxWarning
when identity checks (is
andis not
) are used with certain types of literals (e.g. strings, numbers). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (==
and!=
) instead. (Contributed by Serhiy Storchaka in bpo-34850.)
It currently works by accident in coprocessing by produces a number of these warnings:
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:859: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:866: SyntaxWarning: "is" with a literal. Did you mean "=="?
if self.__RootDirectory is "":
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/tpl/cinema_python/adaptors/paraview/pv_introspect.py:198: SyntaxWarning: "is" with a literal. Did you mean "=="?
if proxy['parent'] is '0' and numberOfProducers > 0:
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:859: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:866: SyntaxWarning: "is" with a literal. Did you mean "=="?
if self.__RootDirectory is "":
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:17: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if rd is not '' and not rd.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:24: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '':
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:32: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '':
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:76: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '' and not os.path.exists(self.__RootDirectory):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:179: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:181: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not os.path.exists(root_directory):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:274: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if not ssp.HasAnnotation("enabled") or not (ssp.GetAnnotation("enabled") is '1'):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/tpl/cinema_python/adaptors/paraview/pv_introspect.py:198: SyntaxWarning: "is" with a literal. Did you mean "=="?
if proxy['parent'] is '0' and numberOfProducers > 0:
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:859: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:866: SyntaxWarning: "is" with a literal. Did you mean "=="?
if self.__RootDirectory is "":
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:17: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if rd is not '' and not rd.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:24: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '':
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:32: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '':
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:76: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if self.__RootDirectory is not '' and not os.path.exists(self.__RootDirectory):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:179: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:181: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not os.path.exists(root_directory):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/detail/exportnow.py:274: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if not ssp.HasAnnotation("enabled") or not (ssp.GetAnnotation("enabled") is '1'):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/tpl/cinema_python/adaptors/paraview/pv_introspect.py:198: SyntaxWarning: "is" with a literal. Did you mean "=="?
if proxy['parent'] is '0' and numberOfProducers > 0:
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:859: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if root_directory is not '' and not root_directory.endswith("/"):
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/coprocessing.py:866: SyntaxWarning: "is" with a literal. Did you mean "=="?
if self.__RootDirectory is "":
/home/olearypatrick/code/ParaView/lib/python3.7/site-packages/paraview/tpl/cinema_python/adaptors/paraview/pv_introspect.py:198: SyntaxWarning: "is" with a literal. Did you mean "=="?
if proxy['parent'] is '0' and numberOfProducers > 0: