[New-bugs-announce] [issue43497] SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants

Greg Darke report at bugs.python.org
Mon Mar 15 03:31:25 EDT 2021


New submission from Greg Darke <darke at google.com>:

The following block of code does not produce a SyntaxWarning in python 3.7 and above (it does produce a warning in python 3.6 and below):

```
assert(False, 'msg')
```

If the tuple is not a constant (for example `(x, 'msg')`), then a warning is still produced.

----------
components: Interpreter Core
messages: 388711
nosy: darke2
priority: normal
severity: normal
status: open
title: SyntaxWarning for "assertion is always true, perhaps remove parentheses?" does not work with constants
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43497>
_______________________________________


More information about the New-bugs-announce mailing list