Improve narrowing with numeric types#20727
Draft
hauntsaninja wants to merge 1 commit intopython:masterfrom
Draft
Improve narrowing with numeric types#20727hauntsaninja wants to merge 1 commit intopython:masterfrom
hauntsaninja wants to merge 1 commit intopython:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
a957403 to
b310848
Compare
This comment has been minimized.
This comment has been minimized.
I added tests for this change in python#20709 so it's easier to see the diff. Like a few others, this was factored out of python#20660 to make that one easier to land. The change in bytes narrowing is also desirable (but unfortunately only applies with --no-strict-bytes). We can figure out something else for that case
b310848 to
8dca9a2
Compare
Collaborator
Author
|
The primer diff + the tests will be fixed by #20728 |
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/specs/openapi/extra_data_source.py: note: In member "weighted_select" of class "VariantUsageTracker":
+ src/schemathesis/specs/openapi/extra_data_source.py:85: error: Statement is unreachable [unreachable]
core (https://github.com/home-assistant/core)
+ homeassistant/components/firefly_iii/sensor.py:190: error: Statement is unreachable [unreachable]
|
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.
I added tests for this change in #20709 so it's easier to see the diff. Like a few others, this was factored out of #20660 to make that one easier to land.
The change in bytes narrowing is also desirable (but unfortunately only applies with --no-strict-bytes). We can figure out something else for that case, as discussed in #20704