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

R8203 no longer valid for CPython 3.11+ #37

Closed
HacKanCuBa opened this issue Nov 6, 2022 · 1 comment · Fixed by #48
Closed

R8203 no longer valid for CPython 3.11+ #37

HacKanCuBa opened this issue Nov 6, 2022 · 1 comment · Fixed by #48

Comments

@HacKanCuBa
Copy link

First of all, thanks for perflint, I love it :D

Now, to the issue at hand: CPython 3.11 implemented zero-cost exception handling (1, 2), therefore a try/except block inside a loop is no longer a perf issue, as it would be wrongfully stated by R8203: Try..except blocks have an overhead. Avoid using them inside a loop unless you're using them for control-flow. (loop-try-except-usage).

Now, I do understand that detecting the Python version being used by the script being analyzed might not be at all possible, but maybe it would be nice to clarify in the message that it does not apply to CPython 3.11+, as it would discourage writing actually performant try/except blocks.

@tonybaloney
Copy link
Owner

Great point. It doesn't make sense to raise this in 3.11+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants