Repository navigation
Fix | ExitError: keep the per-instance exit code with newer click types - #372
Merged
Merged
Conversation
click 8.5 declares ClickException.exit_code as a class variable, so mypy rejects setting it on the instance. click reads it from the instance when exiting, which is how each ExitError gets its own code: keep it, with an ignore that also passes on click 8.0 (unused-ignore). Unblocks the Dependabot runtime group (#365). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
binbashdevops
approved these changes
Nov 15, 2026
Coverage Report for CI Build 43730699524Coverage remained the same at 78.106%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
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.
What?
One line in
leverage/_utils.py:ExitError.__init__keeps settingself.exit_code, now with# type: ignore[misc, unused-ignore]and a comment.Why?
The Dependabot runtime group (#365) moves
clickfrom 8.0.1 to 8.5.1. click 8.5 declaresClickException.exit_codeas a class variable, somypyfails with "Cannot assign to class variable "exit_code" via instance".At runtime nothing changes: click reads
exit_codefrom the instance when it exits, which is how eachExitErrorgets its own code (40, 50, …). The tests assert those codes.unused-ignoremakes the same line pass on click 8.0.1 too, where the ignore isn't needed andwarn_unused_ignoreswould flag it. So this goes in first, and #365 can be recreated on top without a hand-made commit.Testing
mypypasses with click 8.0.1 (currentmaster) and with 8.5.1 (Bump the runtime group across 1 directory with 6 updates #365's lock).After merging:
@dependabot recreateon #365. It has a conflict inpoetry.lockand an extra commit from me with the same fix, which this replaces.🤖 Generated with Claude Code