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

2021-07-28 Thread Irit Katriel
Change by Irit Katriel : -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list

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

2021-03-16 Thread Greg Darke
Change by Greg Darke : -- resolution: -> fixed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2021-03-16 Thread Mark Shannon
Mark Shannon added the comment: New changeset a8ef4572a6b28bcfc0b10b34fa4204954b9dd761 by tsukasa-au in branch 'master': bpo-43497: Emit SyntaxWarnings for assertions with tuple constants. (GH-24867) https://github.com/python/cpython/commit/a8ef4572a6b28bcfc0b10b34fa4204954b9dd761

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

2021-03-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In such case I prefer to write assert not 'reachable' It is shorter than writing False. If I want to keep an exception even with -O, I write raise AssertionError -- ___ Python tracker

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

2021-03-15 Thread Greg Darke
Greg Darke added the comment: I would argue that there is none (especially if it is tuple/something that is always true) -- thus why I would assume that Python would provide a warning. This bug comes from a discussion I was having with someone earlier today where they mentioned that it

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

2021-03-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the use case for assert with a constant? -- nosy: +serhiy.storchaka ___ Python tracker ___

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

2021-03-15 Thread Greg Darke
Change by Greg Darke : -- keywords: +patch pull_requests: +23629 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24867 ___ Python tracker ___

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

2021-03-15 Thread Greg Darke
New submission from Greg Darke : 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