This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thautwarm
Recipients Anthony Sottile, ammar2, barry, brett.cannon, jwilk, miss-islington, nascheme, njs, rhettinger, serhiy.storchaka, steven.daprano, thautwarm, xiang.zhang
Date 2019-12-19.13:39:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576762758.0.0.000530704653187.issue34850@roundup.psfhosted.org>
In-reply-to
Content
Thanks.
However, unfortunately, this warning seems impossible to suppress.

Use following example:

  import warnings
  warnings.filterwarnings('ignore')

  warnings.warn(SyntaxWarning("test"))

  def f(x):
    return x is 5

  print(f(5))

I succeeded in suppressing my own  SyntaxWarning("test") , but the output is still:
  
  python a.py
  a.py:7: SyntaxWarning: "is" with a literal. Did you mean "=="?
    return x is 5
  True
History
Date User Action Args
2019-12-19 13:39:18thautwarmsetrecipients: + thautwarm, barry, brett.cannon, nascheme, rhettinger, jwilk, steven.daprano, njs, serhiy.storchaka, xiang.zhang, Anthony Sottile, ammar2, miss-islington
2019-12-19 13:39:18thautwarmsetmessageid: <1576762758.0.0.000530704653187.issue34850@roundup.psfhosted.org>
2019-12-19 13:39:17thautwarmlinkissue34850 messages
2019-12-19 13:39:17thautwarmcreate