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
holmanb opened this issue
Apr 18, 2024
· 0 comments
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation
The using-constant-test warning shows up on conditional use of SystemExit's code property. This appears similar to, but not the same as #3484.
Given the following code, run pylint on it. Note the comment.
test_pylint.py
importsysdeftest_invalid_W0125():
""" This test demonstrates a false positive for W0640. Message emitted: Using a conditional statement with a constant value Description: Emitted when a conditional statement (If or ternary if) uses a constant value for its test. This might not be what the user intended to do. """foriinrange(5):
try:
sys.exit(i)
exceptSystemExitase:
# pylint incorrectly thinks that the following conditional uses# a constant valueife.code:
print(f"sys.exit() called with argument: {e.code}")
asserte.code==i
DanielNoord
added
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Apr 19, 2024
False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation
Bug description
The using-constant-test warning shows up on conditional use of SystemExit's
code
property. This appears similar to, but not the same as #3484.Given the following code, run pylint on it. Note the comment.
test_pylint.py
Configuration
No response
Command used
Pylint output
Expected behavior
No error
Pylint version
OS / Environment
Ubuntu 24.04
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: