Backport assert_never change to include repr of value#371
Merged
AlexWaygood merged 3 commits intopython:mainfrom Apr 20, 2024
Merged
Backport assert_never change to include repr of value#371AlexWaygood merged 3 commits intopython:mainfrom
AlexWaygood merged 3 commits intopython:mainfrom
Conversation
179c94a to
6d6c48a
Compare
Member
JelleZijlstra
left a comment
There was a problem hiding this comment.
Thanks! Could you also backport the unit tests from the linked PR?
6d6c48a to
84a1ac2
Compare
Contributor
Author
|
Thanks for taking a look — tests are now included! |
This helps to debug what bad data you have. Via python/cpython@93d2801#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887 ```pycon $ PYTHONPATH=src python3.10 >>> import typing_extensions >>> typing_extensions.__file__ 'typing_extensions/src/typing_extensions.py' >>> typing_extensions.assert_never("boo!") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "typing_extensions/src/typing_extensions.py", line 2387, in assert_never raise AssertionError(f"Expected code to be unreachable, but got: {value}") AssertionError: Expected code to be unreachable, but got: 'boo!' ```
84a1ac2 to
46f6df7
Compare
JelleZijlstra
approved these changes
Apr 19, 2024
9b10c4c to
ddb09b4
Compare
AlexWaygood
approved these changes
Apr 20, 2024
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.
This helps to debug what bad data you have.
Via python/cpython@93d2801#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887