Repository navigation
fix(corekit): quiet get's fallback over an out-of-range value (#1845) - #1873
Merged
Merged
Conversation
- exceptions: add a _CaughtByCaller block, backed by a ContextVar, inside which a BaseError of a named class is constructed quiet; BaseError consults it alongside quiet=True. - enum: EnumLookup.get runs _validate_value and cls(key) in a _CaughtByCaller(ValueError) block when default is usable, so a generated override's loud rejection logs nothing and installs no hook there; with no usable default the miss stays loud. - enum: EnumRegistry.register validates in a block declaring nothing caught, so its rejection stays loud even when reached from inside get. - docs: get's docstring gains a 1.5.0 versionchanged and no longer says the value miss stays loud; registry-protocol.rst says what is reported now. - tests: cover quiet fallback, the loud paths, nesting and per-thread scope. Closes #1845
…t a default (#1845) - enum: EnumLookup.get always runs _validate_value and cls(key) in the _CaughtByCaller(ValueError) block, and converts aenum's own miss into a quiet EnumValueError, so a raised value miss is not logged and installs no hook; register stays loud, including from inside get. - docs: get's docstring, versionchanged and registry-protocol.rst say every get miss is quiet and register is loud. - tests: flip the no-default and unusable-default cases to quiet, add the converted miss, get_all, uncaught-traceback and raising-get-reaches- register cases; the #923 loud control now constructs its error directly. Refs #1845
Owner
Author
|
Pushed |
Owner
Author
|
Verdict: GOOD TO GO at
|
Contributor
|
Coverage: 90.05% (unit tier, Python 3.15,
Per-file detail: the |
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Narrow runs only, listed below.Added a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elsewhich a BaseError of a named class is constructed quiet; BaseError
consults it alongside quiet=True.
_CaughtByCaller(ValueError) block when default is usable, so a generated
override's loud rejection logs nothing and installs no hook there; with no
usable default the miss stays loud.
so its rejection stays loud even when reached from inside get.
value miss stays loud; registry-protocol.rst says what is reported now.
Closes #1845
Open scope question, asked on #1845: protocol parsers never pass
defaulttoget, so this quiet path does not change what parsing logs. Whether a no-defaultgetshould also raise quietly is pending the owner.