donnemartin / gitsome

A supercharged Git/GitHub command line interface (CLI). An official integration for GitHub and GitHub Enterprise: https://github.com/works-with/category/desktop-tools
Other
7.58k stars 436 forks source link

Fix Python 3.8 SyntaxWarning: "is not" with a literal #183

Closed ensarkarabudak closed 3 years ago

ensarkarabudak commented 3 years ago
/usr/lib/python3/dist-packages/gitsome/lib/html2text/html2text.py:95: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if c is not ' ' and c is not '  ':
/usr/lib/python3/dist-packages/gitsome/lib/html2text/html2text.py:95: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if c is not ' ' and c is not '  ':
/usr/lib/python3/dist-packages/gitsome/lib/html2text/html2text.py:96: SyntaxWarning: "is" with a literal. Did you mean "=="?
  return c is ' '

This is a new warning added in Python 3.8. From the release notes:

The compiler now produces a SyntaxWarning when identity checks (is and is 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.)