Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple-statements no longer detected in a finally: block #9759

Closed
oprypin opened this issue Jul 1, 2024 · 1 comment · Fixed by #9917
Closed

multiple-statements no longer detected in a finally: block #9759

oprypin opened this issue Jul 1, 2024 · 1 comment · Fixed by #9917
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@oprypin
Copy link

oprypin commented Jul 1, 2024

Bug description

"""hi"""

try:
    pass
finally: pass  # Should complain about [multiple-statements] but doesn't

Configuration

# Empty configuration

Command used

/tmp/pylint/venv/bin/pylint test.py

Pylint output

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Expected behavior

************* Module test
test.py:5:9: C0321: More than one statement on a single line (multiple-statements)

-------------------------------------------------------------------
Your code has been rated at 6.67/10 (previous run: 10.00/10, -3.33)

This behavior used to happen in the past.

5bdc221 is the first bad commit

Pylint version

pylint 3.3.0-dev0
astroid 3.3.0-dev0
Python 3.11.8 (main, May 26 2024, 00:40:16) [GCC 13.2.0]

OS / Environment

No response

Additional dependencies

No response

@oprypin oprypin added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jul 1, 2024
@Pierre-Sassoulas Pierre-Sassoulas added False Negative 🦋 No message is emitted but something is wrong with the code Help wanted 🙏 Outside help would be appreciated, good for new contributors 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 Jul 1, 2024
@nickdrozd
Copy link
Contributor

try and except are counted, while else and finally are not:

try:     pass   # flagged
except:  pass   # flagged
else:    pass   # ignored
finally: pass   # ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants