Repository navigation
fix(raw): annotate Raw.error as the message string it holds (#2225) - #2233
Merged
Merged
Conversation
Data_Raw.error, its TYPE_CHECKING constructor and Raw.read's error were annotated Optional[Exception], but beholder, the frame layer limit and the extension-chain limit all pass a str message. Annotate them Optional[str]; IPv6_Ext, which does receive the exception, is unchanged. Test: tests/protocols/misc/test_raw_error_str_2225_unit.py pins the str on the parse-failure and layer-limit paths, and the three annotations.
Owner
Author
|
Review: GOOD TO GO at
|
Owner
Author
|
Ready to merge at
|
Contributor
|
Coverage: 91.56% (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.
make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— bug fixDescription
Closes #2225.
Data_Raw.error, itsTYPE_CHECKING__init__andRaw.read(error=...)were annotatedOptional[Exception]. Every producer passes astr:beholderpassesstr(exc), and the frame and extension-chain layer limits pass their messages.Optional[str], and the#:comment calls the value the error's message.IPv6_Extis untouched, becauseIPv6._import_next_layerpasses it the exception object.tests/protocols/misc/test_raw_error_str_2225_unit.pychecks thatinfo.erroris astron the parse-failure and layer-limit paths, and that the annotations sayOptional[str].origin/mainthe annotation case fails with'Optional[Exception]' != 'Optional[str]'. The runtime cases pass on both, since the value was already astr.mainand here, so the change adds none.Rawtests, the docs-typehints pin, the docstring contract and the tier guard give 148 passed.