fix: replace bare except clauses with except Exception in inspection.py - #1056
Open
koteshyelamati wants to merge 1 commit into
Open
fix: replace bare except clauses with except Exception in inspection.py#1056koteshyelamati wants to merge 1 commit into
koteshyelamati wants to merge 1 commit into
Conversation
Contributor
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1056 +/- ##
==========================================
- Coverage 76.51% 76.04% -0.48%
==========================================
Files 62 61 -1
Lines 8308 8261 -47
==========================================
- Hits 6357 6282 -75
- Misses 1951 1979 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace two bare
except:clauses inbpython/inspection.pywithexcept Exception:.Changes
Line 272 —
getattr(f, "__name__", None)can raise if the object has a descriptor that throws:Line 282 — comment notes this catches
xmlrpclib.Fault, which is anExceptionsubclass (see issue #202):Why
Bare
except:catchesBaseException, includingSystemExitandKeyboardInterrupt. All exceptions thrown here areExceptionsubclasses, soexcept Exception:is correct and safer.