-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix __new__ and __init__ precedence #18093
Draft
hauntsaninja
wants to merge
1
commit into
python:master
Choose a base branch
from
hauntsaninja:init-new
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+17
−12
Conversation
This file contains 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
hauntsaninja
force-pushed
the
init-new
branch
from
November 3, 2024 06:53
ce89220
to
5a40f11
Compare
Fixes python#5647 See also python#5642
hauntsaninja
force-pushed
the
init-new
branch
from
November 3, 2024 06:53
5a40f11
to
ee93b0b
Compare
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/hashing.py:61: error: Argument 1 to "dumps" of "Serializer" has incompatible type "tuple[tuple[Any, ...], dict[str, Any]]"; expected "D" [arg-type]
- src/prefect/results.py:1175: note: "_cache_object" of "BaseResult" defined here
- src/prefect/results.py:1371: error: Unexpected keyword argument "storage_block" for "_cache_object" of "BaseResult" [call-arg]
- src/prefect/results.py:1371: error: Unexpected keyword argument "serializer" for "_cache_object" of "BaseResult" [call-arg]
- src/prefect/logging/formatters.py:65: error: Argument 1 to "dumps" of "Serializer" has incompatible type "dict[str, Any]"; expected "D" [arg-type]
rclip (https://github.com/yurijmikhalevich/rclip)
+ rclip/main.py:101: error: Need type annotation for "pbar" [var-annotated]
beartype (https://github.com/beartype/beartype)
+ beartype/_check/error/errget.py:579: error: Unused "type: ignore" comment [unused-ignore]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/datatypes.py:94: error: Unused "type: ignore" comment [unused-ignore]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/dbref.py:98: error: Need type annotation for "doc" [var-annotated]
trio (https://github.com/python-trio/trio)
+ src/trio/_tests/test_testing_raisesgroup.py:108: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/test_testing_raisesgroup.py:122: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/test_testing_raisesgroup.py:133: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/test_testing_raisesgroup.py:211: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/test_testing_raisesgroup.py:213: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/test_testing_raisesgroup.py:216: error: Need type annotation for "rg" [var-annotated]
+ src/trio/_tests/test_testing_raisesgroup.py:223: error: Need type annotation for "exc" [var-annotated]
+ src/trio/_tests/test_testing_raisesgroup.py:230: error: Need type annotation for "rg" [var-annotated]
+ src/trio/_tests/test_testing_raisesgroup.py:372: error: Need type annotation for "excinfo" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:32: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:51: error: Need type annotation for "e" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:53: error: Expression is of type "BaseExceptionGroup[Any]", not "BaseExceptionGroup[ValueError]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:60: error: Expression is of type "BaseExceptionGroup[Never]", not "BaseExceptionGroup[ValueError]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:71: error: Expression is of type "BaseExceptionGroup[Never]", not "BaseExceptionGroup[ValueError]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:118: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:121: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:125: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:128: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:132: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:133: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:155: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:158: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:162: error: Need type annotation for "e" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:165: error: Expression is of type "BaseExceptionGroup[Any]", not "BaseExceptionGroup[ValueError]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:169: error: Need type annotation for "excinfo" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:180: error: Expression is of type "BaseExceptionGroup[Any]", not "BaseExceptionGroup[RaisesGroup[ValueError]]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:187: error: Expression is of type "Union[Any, BaseExceptionGroup[Any]]", not "Union[RaisesGroup[ValueError], BaseExceptionGroup[RaisesGroup[ValueError]]]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:201: error: Expression is of type "BaseExceptionGroup[Never]", not "BaseExceptionGroup[RaisesGroup[ValueError]]" [assert-type]
+ src/trio/_tests/type_tests/raisesgroup.py:205: error: Need type annotation for "a" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:206: error: Need type annotation for "b" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:207: error: Need type annotation for "c" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:218: error: Need type annotation for "a" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:219: error: Need type annotation for "b" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:220: error: Need type annotation for "c" [var-annotated]
+ src/trio/_tests/type_tests/raisesgroup.py:232: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:234: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:236: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:238: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_tests/type_tests/raisesgroup.py:245: error: Unused "type: ignore" comment [unused-ignore]
+ src/trio/_core/_tests/test_run.py:458: error: Need type annotation for "excinfo" [var-annotated]
+ src/trio/_core/_tests/test_run.py:806: error: Need type annotation for "group" [var-annotated]
|
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.
Fixes #5647
See also #5642
This PR shouldn't be merged as currently. Just opening it to see primer and as a reminder. We need to do something cleverer that handles the full constructor chain.