You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify SyntaxWarning with literal comparison #103492
Literals are notations for constant values of some built-in types.
In particular bytes, strings, and numbers are discussed in the following. https://docs.python.org/3/reference/expressions.html#literals is more specific.
Python supports string and bytes literals and various numeric literals:
Evaluation of a literal yields an object of the given type (string, bytes, integer, floating point number, complex number) with the given value.
None is a constant, but not a 'literal' as defined in the sections above. This is only to say that the current message is not really ambiguous. Still, the added detail may help some.
Activity
pythongh-103492: Clarify SyntaxWarning with literal comparison
Merge branch 'main' into pythongh-103492
terryjreedy commentedon Apr 13, 2023
https://docs.python.org/3/reference/lexical_analysis.html#literals
None is a constant, but not a 'literal' as defined in the sections above. This is only to say that the current message is not really ambiguous. Still, the added detail may help some.
https://docs.python.org/3/reference/expressions.html#parenthesized-forms
A tuple is a 'parenthesized form' that is either empty or has at least 1 comma. A constant tuple is not really a literal, but testing I see that one is already called a 'literal'.
The test changes look good; can't review the c code.
gh-103492: Clarify SyntaxWarning with literal comparison (#103493)
Merge branch 'main' into superopt
Merge branch 'superopt' into superopt_spec