fix: replace bare except clauses with except Exception in inspection.py by koteshyelamati · Pull Request #1056 · bpython/bpython
Repository navigation
fix: replace bare except clauses with except Exception in inspection.py - #1056
Open
koteshyelamati wants to merge 1 commit into bpython:main from koteshyelamati:main
Open
fix: replace bare except clauses with except Exception in inspection.py #1056 koteshyelamati wants to merge 1 commit into bpython:main from koteshyelamati:main
Conversation
koteshyelamati commented Jul 23, 2026
Copy link Copy Markdown
Summary
Replace two bare except: clauses in bpython/inspection.py with except Exception:.
Changes
Line 272 -- getattr(f, "__name__", None) can raise if the object has a descriptor that throws:
# Before except: # After except Exception:
Line 282 -- comment notes this catches xmlrpclib.Fault, which is an Exception subclass (see issue #202 ):
# Before except: # After except Exception:
Why
Bare except: catches BaseException, including SystemExit and KeyboardInterrupt. All exceptions thrown here are Exception subclasses, so except Exception: is correct and safer.
fix: replace bare except clauses with except Exception in inspection.py
e5aecf2
sebastinas commented Jul 24, 2026 · edited Loading
Copy link Copy Markdown
Contributor
|
|
codecov
Bot
commented
Jul 24, 2026
Copy link Copy Markdown
Codecov Report❌ Patch coverage is
@@ 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 .
|