Skip to content

Failure to report syntax warning #145787

@simon-grantham

Description

@simon-grantham

Bug report

Bug description:

The expression: True is bool fails to yield a syntax warning even though other literals do so.

$ uname -v
#14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2
$
$ python3 --version
Python 3.12.3
$
$ python3
Python 3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print(1 is int)
<stdin>:1: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
False
>>> print(True is bool)
False
>>> 

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions